Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a 100% Java alternative to ImageIO for reading JPEG files?
    primarykey
    data
    text
    <p>We are using Java2D to resize photos uploaded to our website, but we run into an issue (a seemingly old one, cf.: <a href="http://forums.sun.com/thread.jspa?threadID=5425569" rel="noreferrer">http://forums.sun.com/thread.jspa?threadID=5425569</a>) - a few particular JPEGs raise a <code>CMMException</code> when we try to <code>ImageIO.read()</code> an InputStream containing their binary data:</p> <pre><code>java.awt.color.CMMException: Invalid image format at sun.awt.color.CMM.checkStatus(CMM.java:131) at sun.awt.color.ICC_Transform.&lt;init&gt;(ICC_Transform.java:89) at java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:516) at com.sun.imageio.plugins.jpeg.JPEGImageReader.acceptPixels(JPEGImageReader.java:1114) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage(Native Method) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1082) at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:897) at javax.imageio.ImageIO.read(ImageIO.java:1422) at javax.imageio.ImageIO.read(ImageIO.java:1326) ... </code></pre> <p>(snipped the remainder of the stack trace, which is our <code>ImageIO.read()</code> call, servlet code and such)</p> <p>We narrowed it down to photos taken on specific cameras, and I selected a photo that triggers this error: <a href="http://img214.imageshack.us/img214/5121/estacaosp.jpg" rel="noreferrer">http://img214.imageshack.us/img214/5121/estacaosp.jpg</a>. We noticed that this only happens with Sun's JVM (on Linux and Mac, just tested it on 1.6.0_20) - a test machine with OpenJDK reads the same photos without a hitch, possibly due to a different implementation of the JPEG reader.</p> <p>Unfortunately, we are unable to switch JVMs in production, nor to use native-dependent solutions such as ImageMagick ( <a href="http://www.imagemagick.org/" rel="noreferrer">http://www.imagemagick.org/</a> ).</p> <p>Considering that, my question is: Does a replacement for ImageIOs JPEG reader which can handle photos such as the linked one exist? If not, is there another 100% pure Java photo resizing solution which we can use?</p> <p>Thank you!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload