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

Error with a JPG file #1182

Closed
photopea opened this issue Jul 28, 2021 · 7 comments
Closed

Error with a JPG file #1182

photopea opened this issue Jul 28, 2021 · 7 comments

Comments

@photopea
Copy link

I was not able to parse this JPG file correctly with your JPEG decoder. Could you fix it?

JD500013

@nothings
Copy link
Owner

The file contains unknown data after the image data; stb_image sees this as corruption (it's more conservative about accepting such images than other loaders). Looks like to be the same issue as this: jpeg-js/jpeg-js#81

@nothings
Copy link
Owner

nothings commented Jul 28, 2021

Since the Internet does not seem to have any documented explanation for JPEG marker 0, I'm going to consider this a broken image and not fix it. See the above issue for more detailed argument.

@bgyarfas
Copy link

bgyarfas commented Sep 15, 2023

@nothings It's also a problem with all JPEGs generated by DJI drones. Apparently it's a multi-picture format of some sort (link). Are there any flags or alternate methods in STB to ignore "bad data" like this?

@photopea
Copy link
Author

Could you share an image with us, which you can not open in Photopea?

@photopea
Copy link
Author

@nothings could you maybe add 2 lines of code to deal with this bug in JPG files? There are hundreds of thousands of such images out there, and since most of programs can open them, it would be nice if your library could handle them (as people are expecting it).

@photopea
Copy link
Author

@nothings also, my first image contains just one marker 0xFFD9, and that is the last two bytes of a binary file. What do you mean by "unknown data after the image data"? Also, I can not see any marker 0 in the file.

@bgyarfas
Copy link

bgyarfas commented Sep 18, 2023

@photopea I haven't tried photopea, I ran into the error using instant-ngp. Here's an example image that won't load with stb (assuming github doesn't strip the EXIF).
DJI_0396

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

No branches or pull requests

3 participants