Benigno Barbés
Benigno Barbés

Reputation: 19

Error when using libjpeg to decode some images

I'm using libjpeg (python) to decode some strange jpg files generated by a program. The most of the times there is no problem, but it crashes with some files like this error.jpg

It generates the same error with different Python 3.x version, pylibjpeg-libjpeg versions and SO versions. Now I'm trying python 3.11 and libjpeg 2.2

Any hints?

For example, I try:

from libjpeg import decode
I = decode('error.jpg')

Result:

RuntimeError: libjpeg error code '-1038' returned from Decode(): A misplaced marker segment was found - invalid stream, found invalid huffman code in entropy coded segment

Upvotes: 0

Views: 75

Answers (1)

NokutokaMomiji
NokutokaMomiji

Reputation: 43

From checking the file data in a hex editor, it seems like this was created using some AccuSoft software and is not a standard JPEG. So, it makes sense that libjpeg would not be able to decode it. If you really need to access the file, check their software for something that could open it.

Upvotes: 0

Related Questions