treeform / pixie

Full-featured 2d graphics library for Nim.
MIT License
741 stars 28 forks source link

Some jpegs that fail to load with "Invalid JPEG, did not get expected restart marker" (pixie 5.0.1) #503

Open sgmihai opened 2 years ago

sgmihai commented 2 years ago

Examples https://m.media-amazon.com/images/M/MV5BOGY5ODdlM2MtNDcwYy00YjJhLTgwYzktMzJhMWYyNTA1NTMzXkEyXkFqcGdeQXVyNTEzMjAxMjE@._V1_.jpg https://m.media-amazon.com/images/M/MV5BMDI4ZGU1OWYtYTNjMy00YWQ4LTg3M2YtNmUxMDhiZjFhZTYwL2ltYWdlL2ltYWdlXkEyXkFqcGdeQXVyMjc4MjYzOA@@._V1_.jpg https://m.media-amazon.com/images/M/MV5BYTdiYWM3ZDQtOGZlYS00MTRmLWI5ZTgtOWNiY2E3NTI2MDgyL2ltYWdlXkEyXkFqcGdeQXVyNTg1MTA0NQ@@._V1_.jpg

they open without a problem everywhere else though, so I'm thinking this is something that should be fixed, no matter what the cause.

guzba commented 2 years ago

Thanks for reporting the issue. I'm going to merge this in to one issue instead of three separate ones as it is all related to JPEG progressive & restart markers.

guzba commented 2 years ago

https://m.media-amazon.com/images/M/MV5BYjNkYjgwMGYtM2UyYi00ZmRhLTk5MzAtYmU0MDY3ODgzODRiXkEyXkFqcGdeQXVyMjUzOTY1NTc@._V1_.jpg

guzba commented 2 years ago

https://m.media-amazon.com/images/M/MV5BODA3YjY3NmEtMWQ4MC00YmEzLWFkNDQtNjU5ZjNhNjVkYjI0XkEyXkFqcGdeQXVyMDA4NzMyOA@@._V1_.jpg https://m.media-amazon.com/images/M/MV5BNDkyZThhNmMtZDBjYS00NDBmLTlkMjgtNWM2ZWYzZDQxZWU1XkEyXkFqcGdeQXVyMTMzNDExODE5._V1_.jpg

iffy commented 1 year ago

Oh, I see there's already an issue. I added one to a local failing test if you want it: https://github.com/treeform/pixie/compare/master...iffy:pixie:bad-jpeg

I took a first look at fixing this, but I quickly realized I'll need a lot more jpeg knowledge before I can fix it :)

iffy commented 1 year ago

Not all the images posted in this thread fail for the same "did not get expected restart marker" reason.

Failure Image
Invalid JPEG, did not get expected restart marker Image 1 - catherine
Invalid JPEG, did not get expected restart marker Image 2 - world
Invalid JPEG, did not get expected restart marker Image 3 - timelives
Invalid JPEG, invalid chunk marker Image 4 - ghosts
Invalid JPEG, unable to load Image 5 - queens
Invalid JPEG, unable to load Image 6 - breaking