Jpeg problems in Firefox and IE

Problem: Someone emails you an image file. You can see the thumbnail fine in Gmail, so you save it to your hard drive. But when you try to view the image in Firefox, you get this error instead: The image “file:///C:/Documents%20and%20Settings/whatever.jpg” cannot be displayed, because it contains errors. Paint.net and Photoshop can view it. Re-saving the file in Paint.net works; re-saving in Photoshop doesn’t work. What’s going on?

Solution: You got an JPEG which uses CMYK instead of RGB encoding, and Firefox/IE choke on such files. In Photoshop, you can convert the JPGs to RGB colorspace, or you can select “Save For Web…” to make the file valid for common browsers.

Takeaways:
– When you get a weird error message, do an exact search for that error message, e.g. “cannot be displayed, because it contains errors”.
– If you write software, make your error messages as descriptive as possible. Something like “This image is in CMYK color space, so you’re screwed, buddy. Try converting it to RGB instead.” That’s much more helpful than “your file contains errors,” especially since it isn’t really an error. Other programs handle JPEGs like that just fine.

38 Responses to Jpeg problems in Firefox and IE (Leave a comment)

  1. Slightly off topic, but while you’re talking about Gmail and images — I just had to send a bunch of attachments the other day for the first time (gmail isn’t my primary account), and boy was it annoying to have to attach them all individually. If you could mention that to the Gmail department, next time you’re wandering around the Googleplex late at night counting critical masses, that would be handy Matt 😉

  2. Matt_Not_Cutts, if you’re using Firefox you can try the dragandupload extension (https://addons.mozilla.org/firefox/2190/) that allows you to upload multiple files in Gmail just by drag and dropping them into the first attachment box.

  3. We had this problem when provided a lot of images from a shoe/clothing industry some years ago. We used imagemagick for mass conversion which makes things a lot easier:

    Lookup the colorspace of an image:
    # identify -verbose MattCutts.jpg | grep ‘ Colorspace’
    Colorspace: CMYK

    Convert image to RGB colorspace (can also use *.jpg etc.)
    # mogrify -colorspace rgb MattCutts.jpg

    Hope that helps someone 🙂

  4. This error message would be funny!!!
    “This image is in CMYK color space, so you’re screwed, buddy.
    Try converting it to RGB instead.”

    Reminds me of websites that say, “This site is made forIE only. Please change your browser to view my UNIQUE special content…”
    Bye

  5. Well

    Why in the name of flip would anyone want to save a cymk jpeg obvoisly the developers of IE and FF thought the same.

    I think the sender of the image needs to read the photoshop manual – of the top of my head cmyk is for print and so you’d should only eaver see that in image formats designed for print. the gaunt is going to be wrong for a rgb screen as well

  6. Maurice – many web designers work hand in hand with graphic designers and indeed like myself, some people fill both rolls. So in design studios you do get a variety of colour formats floating around. What I would suggest is not to use an internet browser as your default image viewer, that is not what it was for. Plus as I’m sure that you are all aware, they will only display images at 72dpi.

  7. Hello matt,
    A site of mine has gone down because of over bandwidth usage. Currently showing a over use message on pages. (only the message, not the original content.)
    This probably will continue till the start of the next month.
    Would the site suffer some sort of penalty in google because of this, or will things be normal once it gets back?

    BTW, it has a large hosting pack, but guess wasn’t enough…

    I was thinking of asking this on forums, but webmasters wouldn’t know what exactly happens at google. so asked here.
    Can you please shed some light on this?
    Thanks

  8. Perhaps you should file a bug report? 🙂

  9. Actually, here’s the Mozilla bug:

    https://bugzilla.mozilla.org/show_bug.cgi?id=44781

    Fancy pestering some Google coders to fix it for us? 😉

  10. Another sometimes bizarre event in IE 6+ is trying to save a .jpg and the PC INSISTS ….YES, INSISTS on saving it as a .bmp

    It does not happen most of the time, only occassionally. There ARE of course , work-arounds & tricks most users have learned.

    But in the beginning…. 🙁

  11. I ran into this problem just last week when converting print ready pdfs to jpegs in Imagemagick & Ghostscript. Had to run 20,0000 thumbnails through a cmyk – rgb colorspace conversion as a result. Not fun.

  12. Better yet, Firefox should just display the darn thing – it’s not hard. The relevant code in the gd library is a handful of lines.

    No point in arguing that they don’t want to encourage bad practices – Firefox already supports displaying BMPs, which are a vastly dumber thing to put on a web page.

    But yes, by all means, if you’re not going to support something, a relevant error message helps.

  13. >> I just had to send a bunch of attachments the other day for the first time

    Ever heard of ZIP, RAR, and other such compressed files?

    Just the right tool for sending a bunch of things at once… and the original individual file date/time-stamp details also get preserved too.

  14. Matt, I just posted on http://www.Oiskas.com about IE7’s error attempting to FTP using the address bar. This may also be helpful for folks using IE7 if you care to link to it.

  15. What about Opera and Safari?

  16. Thanks Matt, for your answers.

    Last question (I promise).

    Do supplemental results factor in, in any way in the PR of supplemental result pages? I mean, if a site has many dynamic pages and all of them are suppl. results, does Google still find a reason to give this pages individual PR?

  17. Its interesting that you bring this up. I am the director of internet marketing at an advertising agency and lately when I get images from one of our artists and try to pop them onto the web I get this error. I have been going into photoshop, saving for Web and then the file is fine. Thanks for pointing out exactly what the problem is thats causing this issue. Now I can address it and save myself some time. You rock!

    xBMANx

  18. Opera CAN display this kind of images. (:

  19. It’s such a pain I know. Especially this day and age with all the technological advancements. But I always remember this vital point “Programmers are human”.

    It’s something so many keep forgetting. 🙂

  20. Well, if the developers knew what’s happening I bet they’d just display the image, instead of an error message. I guess we could just look in the Firefox source code? 🙂

  21. On a somewhat related JPEG note: Are you aware of the nascent JPEG 2000 standard? One of the things that caught my attention with it: it allows the embedding of XML metadata right into the image. I presume that this could be helpful for image searches? Of course, the browsers don’t support this format, so it might be a lost cause. Matt, any insight?

  22. PS: Searching for a full error message text is a good tip indeed. Sometimes, Google Groups/ usenet search of it is worthwhile too. And it’s equally good for a blogger on the other hand to quote the text of the bug if they’re discussing it so others can search for something and find the blog post.

  23. I have seen similar errors while opening PDFs from FF.

  24. I use GIF images on my web pages as in practise they are quite compatible with various old and new operating systems and browsers according to my experience.

  25. I thought the standard for webpages was rgb files and those for print were cmyk. I always use rgb when I do my web images because that is or was the standard, as is 72dpi.

  26. Quite an amusing comment with regards to the error message description. I often get errors like ‘Oops! Something has gone wrong’ on Google websites!

  27. Perhaps you should file a bug report?
    I think so!

  28. Shortshire,
    You’re correct – the standard for images on the web and indeed in general on digital devices (tv’s .etc) is RGB. CMYK is one of the printing standards (plus spot colours, pantones .etc) and can easily be viewed on a computer, even if it seems not to work in some browsers. I have personally not experienced this.

    It’s commenly created in programs like PhotoShop & Indesign.

    CMYK tends to be much duller on screen, off shade perhaps compared to its RGB equivelant. It doesn’t give you a true representation on screen as what that image or colours should look like. Hence why RGB is the digital standard!

    Tomi Häsä;
    Gif images won’t ever be effected – they actually can not be CMYK encoded! So you’re safe. Although i wouldn’t advise saving a photo or any type of image thats highly colourful as a gif – they generally are either 128 or 256 colours only.

    Cheers,
    Aden.

  29. Hi Matt,

    It’s interesting that you mention this recently. I just went through the same issue with my company in October. If you’re interested, here’s the article I posted along with everyone’s comments http://www.followsteph.com/2006/10/19/landlordmaxs-most-challenging-bug/ Another interesting tidbit, this very same issue is present in the Java Runtime.

    We had a few alternatives on how to solve this issue, and if you’re interested, here’s the solution we ended up with at the end: http://www.followsteph.com/2006/10/22/business-versus-technical-solutions/

    Regards,
    Steph

  30. “CMYK”, “RGB” or “JPG” means nothing to an average user of a web browser.

    Developers should continue to provide simple, understandable error messages as Microsoft and Mozilla have in this case.

    Below this in much smaller type they should display an error number which is much more tidy and unique for googling…

  31. Matt,
    I know this is late considering your post date, but just wanted to say thanks for making my life a little easier today. I read your blog regularly, but today I was searching for the solution to this exact problem through Google and you were # 10 for – convert read only .jpeg files.

    Best,
    David

  32. Be aware that imagemagick doesn’t seem to get the colour conversion right everytime if you do a mogrify to rgb. haven’t found a solution yet, maybe need a colour profile.

  33. when ever i try to open a jpeg file in firefox , it shows an error , while the same file open perfect in explorer.

    can any one please help me to find a solution?

  34. I am not sure, sometimes I get that problem though

  35. Nice post, yes people need to be trained to search for specific error messages when researching a problem and write down specific error messages.

    Programmers also have to be trained to use specific error messages and to always report an error, outputting any error they have access to.

    FYI, Safari 3.1 displays these types of jpegs fine.

  36. Lance Haverkamp

    The error message is correct. CMYK is not a valid color scheme for a jpg file. The JPEG/JFIF file specifications never included CMYK, just RGB. This is an Adobe problem for allowing their users to save files in this bogus non-standard format in the first place.

  37. Thank you – I had an advertising banner from a client that was working in FF and not in IE at all…
    Found this page through Goog and hey presto – resaved it as RGB in Photoshop and bam, we’re cooking with gas!

    Thank you.

  38. 3 days, 2 sleepless nights and the problem was the images!! Of course my CMYK images didn’t show up in IE or Chrome. Of course they did show up in FF and Safari and Opera. Despite my previously directed anger towards IE and Chrome – if FF, Safari and Opera actually followed standard, I would have discovered the CMYK issue 3 days ago. Instead I blamed IE and Chrome who for once, were right in this case. CMYK is for printed and a four color press. RGB is for the web and screen. Allowing a CMYK image to appear like Opera, FF and Safari does a disservice to the entire web design and user community. It lowers the techinical standards of us Web Designers.
    Arghh.. Oh well. Thanks for letting me rant a bit on your blog. But more importantly, thanks for having it up to find.
    -DK

css.php