Today I've encountered the jpeg format and the conversion between CMYK and RGB.
I'm working with ImageMagick and the struggle to view 'corrupted images' at least that is what Firefox and Internet Explorer try to tell us.
But in fact they just can't read CMYK. And I don't blame them, they have no business reading it anyway, they should stick to RGB.
The command turned out to be quite simple:
convert myCMYKimage.jpg \
-colorspace rgb \
...
The colors however aren't all that great, in fact if you plan on using it seriously they plain s*ck, but all in all I blame that on the user who uploads it, not the 'failing' of the browsers or IM in this part.
IM supports much more advanced way in converting to RGB, using color profiles, etc. But this script is used in a public upload system and I'm not planning to fix something the user should have taken care of!
Thanks to ##imagemagick on freenode IRC who helped me with this.