Skip to main content
Known Participant
December 9, 2008
Question

JPEG and color management

  • December 9, 2008
  • 62 replies
  • 12736 views
Hi. Is it impossible to get 100% identical colors (if we leave aside the jpeg compression artefacts) when saving a .jpeg file with Photoshop using the highest quality setting (12) ?
    This topic has been closed for replies.

    62 replies

    Ramón G Castañeda
    Inspiring
    December 9, 2008
    Yes, I'm using Photoshop 11 ("CS4").

    Here's your BMP file saved in CS4:

    http://www.mediafire.com/?iuojrmltj2t
    Ramón G Castañeda
    Inspiring
    December 9, 2008
    Rats! I just lost a post I was typing. Grrr.

    As I was saying, :), if you run your cursor in the BLACK rectangle as per step #7 above, over the areas where we know now that the pixels aren't quite black, you'll see values with minimal deviations por pure black, as I noted above in post #12 ( values like 0,0,1 or 1,0.1 or 1,0,0).

    I am surprised that the variations in color rendition are that insignificantly small.

    In any event, I'm glad I don't need JPEGs myself.

    I'll go download your image now and save it as BMP as requested.
    Known Participant
    December 9, 2008
    Ramón, as I don't have CS4, could you maybe do me favour? Could you open this file http://img528.imageshack.us/img528/8885/fotoqb2.jpg in CS4 save it as BMP, zip it and upload the ZIP file somewhere (for example http://www.mediafire.com) ? I would be very thankful for that, Ramón!
    And please make sure, that sRGB is used as color space when opening the jpeg file.

    Here is a slightly related thread on this topic, if you are interested : http://www.adobeforums.com/webx/.59b726f1/0
    Known Participant
    December 9, 2008
    Okay. Thanks for posting your results. It's good to see that on CS4 (as you said that's what you work on), the results are the same. It's basically the same picture I posted above.

    So obviously the question is: What can we see from this picture?
    The white pixels in the image show pixels that have changed during the conversion to JPEG. Two sort of differences can be seen:

    1) We can see jpeg compression artefacts in the form of random white pixels around the letters and numbers and around hard edges, which is typical for JPEG compression and was expected.

    2) We can see entire color patches in white, meaning that the color of the whole patch has changed during the JPEG conversion. This was - at least for me - an unexpected result.

    If this turns out to be true, than JPEG does not only suffer from the typical JPEG artefacts, but also from overall inaccurate color rendition.

    I hope an expert here can confirm or correct these findings.
    Ramón G Castañeda
    Inspiring
    December 9, 2008
    Mark, <br />&gt;Ramón, following the detailed steps above, were you able to reproduce the image I posted here ? <br />http://www.imageboo.com/files/27yo13jqgnjssir7vfqk.png <br /> <br /> This is what I got: <br /> <br />c <a href="http://www.pixentral.com/show.php?picture=1kFuIZZvqsxOH7FrCGoLfVOnnyQU2" /></a> <img alt="Picture hosted by Pixentral" src="http://www.pixentral.com/hosted/1kFuIZZvqsxOH7FrCGoLfVOnnyQU2_thumb.jpg" border="0" /> <br /> <br /> For the sake of thoroughness, I'll confirm that I tried the very same exercise with a TIFF and a PSD saved from the same PNG, and after all going through all the steps with each, there were absolutely no different pixels.
    Known Participant
    December 9, 2008
    Ramón, following the detailed steps above, were you able to reproduce the image I posted here ?
    http://www.imageboo.com/files/27yo13jqgnjssir7vfqk.png
    Known Participant
    December 9, 2008
    The bottom line is this: We opened a PNG file, saved it as JPG and compared both images in difference blending mode. In this mode all identical pixels are completely black (try it out with two copies of the same layer).

    Our goal is to find out which pixels in the JPEG file differ from the PNG file (obviously there MUST be non-identical pixels, as JPEG is a lossy format!). As we know that identical pixels are completely black (as mentioned above), we want to find pixels that are NOT completely black.

    How do we achieve this? With tolerance=0 the magic wand only selects pixel which have exactly the same color as the pixel we click on. So when clicking on a black pixel, the magic wand selects all the completely black pixels in the entire image (entire image because contiguous is set to yes). All completely black pixels are now selected. And this means we have selected all the pixels, that are identical on both layers.

    Now we invert the selection, so that it covers the non-identical (=different) pixels. We fill this selection with white, so all different pixels are now white.

    [end of bottom line]
    ----

    I always thought, that JPEG compression artefacts (at least for maximum quality JPEG images) concern only edges and areas in an image with high local contrast.

    But I wouldn't expect large areas with a single color have its color changed in the course of the JPEG compression. Because if colors would change like this, then what is color management good for in JPEG files and why can an ICC profile be embedded in a JPEG file at all in this case if colors change anyway ?

    It's funny, because the same results that make you say you might rethink using JPEGs let me find JPEGs a whole lot worse than I thought them to be anyway ...
    Ramón G Castañeda
    Inspiring
    December 9, 2008
    Thanks for the extensive explanation, Mark.

    I must admit that I still don't quite grasp your methodology, nor do I understand how all that translates into a color management issue rather than a JPEG compression weakness. However, it's certainly not really conducive to re-thinking my aversion to JPEGs. :D
    Known Participant
    December 9, 2008
    > Frankly, that's a hell of a lot better than I, as a JPEG hater, would have ever expected a damned JPEG to do, even at maximum quality.

    From my point ov view, jpeg artefacts (along hard edges, etc.) are expected to occur. But entire color patches with the wrong color must not occur if color management works correctly.
    Known Participant
    December 9, 2008
    Thanks for helping in this test despite hating JPEGs

    Your screenshots proves that there are differences not only along hard edges (i.e. the borders between color patches), but that also whole color patches are affected.

    This would mean, that color management isn't working properly with jpeg files. I hope someone with sound color management knowledge can confirm this or otherwise explain the problem.

    > When using the Magic Wand (which I confess I don't understand what that is supposed to prove)

    I try to explain once again:

    1) Download the original source file (png) from the link above
    2) open it in Photoshop and assign sRGB profile
    3) save it as jpeg with highest quality settings possible (12)
    4) open the jpeg file
    5) add it as new layer over the png file
    6) select "difference" as blending mode in the layers palette
    7) now the whole image should appear almost black
    7) select the magic wand tool (with abovementioned settings!)
    8] click somewhere into the formerly gray area

    explanation: you just selected all completely black pixels (0,0,0) i.e. all pixels that are identical in both layers

    9) you should see "marching ants" forming rectangular patterns
    10) invert the selection (Shift+i)

    explanation: the selection now covers all the other pixels, i.e. all pixels which are different between both layers

    11) create a new empty layer and select it in the layers palette
    11) set the foreground color to white
    12) fill the selection with white (alt+backspace on Windows, accordingly on Mac)
    13) set the blending modes of all layers back to normal

    explanation: you now have the image I posted above, i.e. you see all identical pixels in their respective color and all different pixels in white


    The expected results would be white pixels along the borders between color patches, resulting from jpeg compression, but if color management works correctly there must not be entire color patches with the wrong color (i.e. white here)