Uploaded image for project: 'Imaging'
  1. Imaging
  2. MGNLIMG-183

GIF images generated with poor quality

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 3.2.6
    • 3.2.4
    • None
    • Saigon 37
    • 8

      GIF images going through the imaging module come out distorted.

      Steps to reproduce

      Upload the "example.gif" image using Asset app.

      Solution

      Handle input images whose size is 1-4 bits per pixel.

      info.magnolia.imaging.util.ImageUtil

      public static int getImageType(BufferedImage img) {
          int imageType = img.getType();
          switch (imageType) {
              case BufferedImage.TYPE_CUSTOM: // If the source image type is not set...
                  imageType = img.getAlphaRaster() != null ? BufferedImage.TYPE_INT_ARGB_PRE : BufferedImage.TYPE_INT_RGB;
                  break;
              // Handle both TYPE_BYTE_BINARY (1-4 bit/pixel) and TYPE_BYTE_INDEXED (8 bit/pixel).
              case BufferedImage.TYPE_BYTE_BINARY:
              case BufferedImage.TYPE_BYTE_INDEXED:
                  if (img.getColorModel() != null) {
                      imageType = img.getColorModel().hasAlpha() ? BufferedImage.TYPE_INT_ARGB_PRE : BufferedImage.TYPE_INT_RGB;
                  }
                  break;
              default:
                  break;
          }
          return imageType;
      }
      

        Acceptance criteria

          1. example.gif
            example.gif
            1 kB
          2. example-proccessed.gif
            example-proccessed.gif
            11 kB
          3. pinkHeart.gif
            pinkHeart.gif
            4 kB
          4. pinkHeartAfterProcessed.gif
            pinkHeartAfterProcessed.gif
            4 kB

              hieu.nguyen Hieu Nguyen Duc
              rgange Richard Gange
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD

                    Estimated:
                    Original Estimate - 0.75d Original Estimate - 0.75d
                    0.75d
                    Remaining:
                    Remaining Estimate - 0d
                    0d
                    Logged:
                    Time Spent - 8d 0.75h
                    8d 0.75h