1

I have a group of .jpg images from the same source that all seem to behave fine: I can open/edit them with eog/Kolourpaint/GIMP, their thumbnails load correctly in Nautilus, etc.

However, when I try to upload these images (through a web browser onto Tumblr for instance), one (and only one) of these does not preview in the Nautilus file upload browser, and Tumblr returns an error when I try to upload this file.

What kinds of issues would cause an otherwise well-behaved jpeg image to not preview in the Nautilus file upload browser?

1

This does not answer your question directly, but a recipe for dealing with "slightly corrupt" images is the convert flap...

$ convert broken.jp cbroken.png
$ convert cbroken.png good.jpg

I find that image manipulation tools have different tolerance levels for specification compliance. Convert is both very tolerant and compliant in my experience.

  • Thanks for the suggestion. I had considered using convert and it actually outputted some useful debug information. – olliezhu Nov 13 '12 at 7:56
0

At sthysel's suggestion, I converted my corrupted jpeg into a png, which revealed the problem and also provided me with a functional png that could be uploaded in the jpeg's place.

$ convert bad.jpg okay.png
convert: Premature end of JPEG file `bad.jpg' @ warning/jpeg.c/EmitMessage/228.
convert: Corrupt JPEG data: premature end of data segment `bad.jpg' @ warning/jpeg.c/EmitMessage/228.

Taking a look inside the actual contents of bad.jpg, it was apparently missing the EOF bytes:

000d330: 8cbd e32f f164 95a4 4827 54e0 1264 8807  .../.d..H'T..d..                  
000d340: 8436 479f cd1e afa4 d9e3 0a              .6G........

So I padded the file with the necessary bytes, which also worked to fix the jpeg.

000d330: 8cbd e32f f164 95a4 4827 54e0 1264 8807  .../.d..H'T..d..
000d340: 8436 479f cd1e afa4 d9e3 3fff d90a       .6G.......?...
0

Two things that have caused compatibility issues for me in the past were:

  • Previews saved in a jpeg - disable storing previews (if supported by software)
  • CMYK images saved as jpeg - convert to RGB before saving or export a copy as RGB

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.