Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problematic JPEG image #22

Closed
marcuslinke opened this issue Dec 10, 2013 · 12 comments
Closed

Problematic JPEG image #22

marcuslinke opened this issue Dec 10, 2013 · 12 comments
Assignees

Comments

@marcuslinke
Copy link

Hi Harald,

just found another image that can't be read with the JPEGImageReader. Maybe you will find some time to take a look. Not able to upload it here. Seems github has some problems with it also.

https://dl.dropboxusercontent.com/u/13086504/content.jpg

Cheers

@Dima-HAN
Copy link

Did not work for me too, here is an exception if it helps

java.lang.NullPointerException
at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader.getSourceCSType(Unknown Source)
at com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader.read(Unknown Source)
at javax.imageio.ImageIO.read(ImageIO.java:1448)
at javax.imageio.ImageIO.read(ImageIO.java:1308)

@ghost ghost assigned haraldk Dec 11, 2013
@haraldk
Copy link
Owner

haraldk commented Dec 11, 2013

Hmmm..

NullPointerExceptions are never good. I'll look into it, as soon as possible.

As always, thanks for reporting and providing test a case!

.k

@haraldk
Copy link
Owner

haraldk commented Dec 15, 2013

Hi Marcus,

Less time in my day job these days to fix issues like this.. But I finally found some time today, and identified the problem. There seems to a lot of trash/padding 0x00s between two JPEG markers, apparently for no good reason. Don't think this is allowed according to spec, but seems to be common (google for "Corrupt JPEG data: extraneous bytes before marker"). I can probably mask these bytes out of the stream, and handle in some way, but I need to work out a good strategy first... Stay tuned. :-)

Harald K

@marcuslinke
Copy link
Author

Hi Harald, thanks for your effort so far. I just wonder how many different JPEG spec violations are out there that must be considered... seems like an unsolvable task to me :-(

@haraldk
Copy link
Owner

haraldk commented Dec 16, 2013

Well..

If I only knew upfront all the different spec violations there was...
As long as handling one type of violation doesn't rule out reading other images (which is still the case), I think we're good. :-)

I made the reader able to read your image. I just want to provide better warning feedback to the listeners and clean things up a little before checking in.

Side note: The (Exif?) thumbnail seems broken (correct data bout 2/3 down, then nothing). Is this the case in other software too?

Best regards,

Harald K

@haraldk
Copy link
Owner

haraldk commented Dec 16, 2013

Just pushed a fix.

@haraldk haraldk closed this as completed Dec 16, 2013
@marcuslinke
Copy link
Author

Thanks! ...and yes, you're right. It seems MacOS uses the damaged embedded thumbnail while rendering the file (preview) icon.

@haraldk
Copy link
Owner

haraldk commented Dec 17, 2013

Cool. I'm home free then. ;-)

@haraldk haraldk added the Bug label Mar 3, 2014
@galusben
Copy link

Thanks for this fix and the great job you have done with this library!

@huxi
Copy link

huxi commented Feb 19, 2015

Has this fix been released? I see a similar issue with 3.0 but didn't check 3.0.2 yet. Will do so now...

@huxi
Copy link

huxi commented Feb 19, 2015

Alright... I got a NPE at

    com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader.getSourceCSType(Unknown Source)
    com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader.read(Unknown Source)
    javax.imageio.ImageReader.read(ImageReader.java:939)

But the reason for this was that the image with a jpeg extension was actually a png. Changing the extension the png fixed the problem. Should I file a new issue for that?

@haraldk
Copy link
Owner

haraldk commented Feb 19, 2015

@huxi My plugins does not do file format recognition by looking at file extensions, so I'm not sure how that happened... But yes, file an issue, with the code you are using and attach the image you used, and I'll look into it.

The original issue has been fixed, at least both 3.0.1 and 3.0.2 has no problems reading the linked image.

Harald K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants