views:

619

answers:

2

When resizing images along the lines shown in this question occasionally the resulting image is inverted. About 1% of the images I resize are inverted, the rest is fine. So far I was unable to find out what is different about these images.

See resized example and original image for examples.

Any suggestions on how to track down that problem?

+2  A: 

Your original image won't display for me; Firefox says

The image “http://images.hudora.de/o/NIRV2MRR3XJGR52JATL6BOVMQMFSV54I01.jpeg” 
cannot be displayed, because it contains errors.

This suggests that the problem arises when you attempt to resize a corrupted JPEG, and indeed your resized example shows what looks like JPEG corruption to my eye (Ever cracked open a JPEG image and twiddled a few bits to see what it does to the output? I have, and a few of my abominable creations looked like that). There are a few JPEG repair tools out there, but I've never seriously tried any of them and don't know if they might be able to help you out.

kquinn
same in chrome, but IrfanView can open them, so it must be an error in the image
RSabet
On MacOS I was open it "everywhere" (Safari, Preview) - so I never thought of the original image being corrupt. Thanks for the hint!
mdorseif
+3  A: 

I was finally able to find someone experienced in JPEG and with some additional knowledge was able to find a solution.

  1. JPEG is a very underspecified Format.
  2. The second image is a valid JPEG but it is in CMYK color space, not in RGB color space.
  3. Design minded tools (read: things from Apple) can process CMYK JPEGs, other stuff (Firefox, IE) can't.
  4. CMYK JPEG is very under specified and the way Adobe Photoshop writes it to disk is borderline to buggy.

Best of it all there is a patch to fix the issue.

mdorseif