[MGNLIMG-142] Replace removed JPEG classes in Java 7 Created: 04/Dec/14 Updated: 25/Aug/15 Resolved: 19/Jun/15 |
|
| Status: | Closed |
| Project: | Imaging |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 3.2 |
| Type: | Task | Priority: | Neutral |
| Reporter: | Federico Grilli | Assignee: | Espen Jervidalo |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Template: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||||||||||||||||||||||||||||||
| Task DoR: |
Empty
|
||||||||||||||||||||||||||||||||||||||||||||
| Release notes required: |
Yes
|
||||||||||||||||||||||||||||||||||||||||||||
| Date of First Response: | |||||||||||||||||||||||||||||||||||||||||||||
| Epic Link: | Housekeeping 5.4 CMS | ||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
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.
See also https://blog.idrsolutions.com/2012/05/replacing-the-deprecated-java-jpeg-classes-for-java-7/ |
| Comments |
| Comment by Magnolia International [ 05/Dec/14 ] |
|
|
| Comment by Magnolia International [ 05/Dec/14 ] |
|
|
| Comment by Magnolia International [ 05/Dec/14 ] |
|
... and this has in fact been reported as |
| Comment by Federico Grilli [ 09/Dec/14 ] |
|
After some research and some unsuccessful attempts at fixing the problem, I found further confirmations about the huffman.jpg issue likely being caused by ImageIO.read(..) returning a BufferedImage without or missing some image metadata (http://stackoverflow.com/questions/9340569/jpeg-image-with-wrong-colors). At any rate, writing back the metadata is a bit cumbersome given that our API uses BufferedImage (see info.magnolia.imaging.DefaultImageStreamer.write(..)) and one cannot get IIOMetadata from it. Also, as explained in the test comment quoted above in description that "is not practical since we might want to overlay another image on top for instance" IMO, we have these options
#2 keep the solution using the deprecated com.sun classes relying on the fact that the Oracle Java runtime still provides them |
| Comment by Federico Grilli [ 10/Dec/14 ] |
|
I went for the apache commons-imaging http://commons.apache.org/proper/commons-imaging/ solution even though this means we need to cut our own final release from trunk (e.g. from https://apache.googlesource.com/commons-imaging/) as long as Apache doesn't do that. 1.0-SNAPSHOT appears to be stable and used in production by many people anyway (http://mail-archives.apache.org/mod_mbox/commons-dev/201311.mbox/%3CCACZkXPxuQcLrTBnLpP36OfT-FGRBigUFjPZyE+_HfVWxyRAgcA@mail.gmail.com%3E) As a side note Apache Imaging was previously known as Apache Sanselan whose latest stable release is 0.97 (in 2012 I believe). Unfortunately we cannot use it as it doesn't support JPEG format. |
| Comment by Federico Grilli [ 10/Dec/14 ] |
|
For the release notes: info.magnolia.imaging.operations.load.SunJPEGCodecImageDecoder and info.magnolia.imaging.operations.load.SunJPEGCodecImageDecoderAlt are removed in 3.2 and replaced with info.magnolia.imaging.operations.load.CommonsImagingImageDecoder |
| Comment by Christoph Meier [ 21/Jan/15 ] |
|
Since we recommend running the Magnolia 5.3.x versions on Java 6, backporting this replacement to MGNLIMG 3.1.3 is not necessary. |
| Comment by Magnolia International [ 09/Mar/15 ] |
|
The fixes for this are on master, but there is still a comment in the pom that says "Until http://jira.magnolia-cms.com/browse/MGNLIMG-142 is integrated we have to [...]"; either the comment needs to go, be updated, or what it comments on needs to go |
| Comment by Federico Grilli [ 10/Mar/15 ] |
|
Hmm, afaics the fixes I did and which should allow us to get rid of those Sun proprietary class are on the |
| Comment by Magnolia International [ 10/Mar/15 ] |
|
Agh, my bad, I thought it had been reviewed and merged already ! So if I read history correctly, this is still pending review, right ? |
| Comment by Federico Grilli [ 10/Mar/15 ] |
|
Yup |
| Comment by Espen Jervidalo [ 12/Mar/15 ] |
|
via http://stackoverflow.com/a/16149142 I found this: "TwelveMonkeys ImageIO is a collection of plug-ins for Java's ImageIO. These plugins extends the number of image file formats supported in Java, using the javax.imageio.* package. The main purpose of this project is to provide support for formats not covered by the JDK itself. [...]" Before starting to maintain our own releases of apache-imaging, I would really like to consider using these plugins. Stable and up-to-date releases is one big plus, compared to that more or less dead apache project. EDIT: Sorry, missed Federico's comment from 9. November. |
| Comment by Philip Mundt [ 19/Jun/15 ] |
|