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

Replace removed JPEG classes in Java 7

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 3.2
    • None
    • None
    • None
    • Yes

      Package com.sun.image.codec.jpeg was removed in Java7 but is used by info.magnolia.imaging.operations.load.SunJPEGCodecImageDecoder and info.magnolia.imaging.operations.load.SunJPEGCodecImageDecoderAlt.
      The compiled classes in that package are however still provided by the Java JRE in rt.jar (so at runtime one can still use them). In theory one should replace them with Java's ImageIO but as mentioned in a comment at info.magnolia.imaging.util.ImageUtilTest.testDecodingHuffmanImage() that doesn't seem to work very well with some jpegs (also verified personally by running that test and comparing the outputs with the expected result [used java version "1.8.0_25" on a Mac OS X 10.10.1])

      not exactly sure what differentiates this jpeg yet - but com.sun.image.codec.jpeg.JPEGImageDecoder handles it correctly for us
      while the imageio's built-in jpeg support will only "work" if we pass the image's metadata back to the write (which is not practical since we might want to overlay another image on top for instance)

      See also https://blog.idrsolutions.com/2012/05/replacing-the-deprecated-java-jpeg-classes-for-java-7/

        Acceptance criteria

              ejervidalo Espen Jervidalo
              fgrilli Federico Grilli
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoR