Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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

$ convert 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.

share|improve this answer
Thanks for the suggestion. I had considered using convert and it actually outputted some useful debug information. – uhwuggawuh Nov 13 '12 at 7:56
up vote 0 down vote accepted

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.......?...
share|improve this answer

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
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .