2
\$\begingroup\$

I often read that PNG is a lossless format so I decided to do a little experiment to try to prove it. In Photoshop I did Save for Web to PNG-24. Then, I did File->Place to open the PNG and import it to the original file as a new layer. Then, I changed the blending mode to Difference. If the two layers were identical the appearance should be all black. It wasn't. I tried various options such as converting/not converting to sRGB, including transparency or not. But they all show a difference.

I would expect a truly lossless compression algorithm to yield an exact copy of the original. Is this a problem in the PNG format? A problem with Photoshop's implementation of the format? Or what?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ I expect that it's a detail of Photoshop's "save for web" -- there may be some lossy changes in order to provide more optimal compression. But that's just a guess. \$\endgroup\$
    – mattdm
    Commented Aug 15, 2014 at 16:00
  • 3
    \$\begingroup\$ PNG-24 is 8 bits per channel, if your image is 16bit then you will see differences if you save as 8bit \$\endgroup\$
    – Matt Grum
    Commented Aug 15, 2014 at 19:22
  • \$\begingroup\$ My image is 8-bits/channel so I don't think that's the issue. \$\endgroup\$ Commented Aug 15, 2014 at 20:54
  • \$\begingroup\$ PNG is a bad choice of format for photography. \$\endgroup\$ Commented Aug 17, 2014 at 7:31

1 Answer 1

2
\$\begingroup\$

I did some more tests and I think the issue is color space conversion. Here's the testing procedure I used with Photoshop CC 2014:

  1. Create a new file with 8-bit, Adobe RGB 1998 color space.
  2. Create a rainbow gradient.
  3. Save for Web as PNG; don't convert to sRGB.
  4. Place embedded the PNG file just saved.
  5. Change PNG layer blend mode to difference. There is a very noticeable difference (not all black). So, the PNG file is not the same as the original.

Then, I did the following procedure:

  1. Create a new file with 8-bit, Adobe RGB 1998 color space.
  2. Create a rainbow gradient.
  3. Edit -> Convert to Profile with Destination Space: sRGB
  4. Save for Web as PNG; don't convert to sRGB.
  5. Place embedded the PNG file just saved.
  6. Change PNG layer blend mode to difference. The appearance is solid black indicating that the two layer are the same.

So, this implies that Save for Web as PNG saves in sRGB color space even if you don't check the Convert to sRGB checkbox. I believe you'll get a better color conversion if you do check this checkbox or if you do the separate Convert to Profile steps as in 3. above. But it looks like you get sRGB either way. Unfortunately, Save for Web as PNG fails to embed a color profile or tag regardless of whether you check the box or not. Also, regardless of whether you do Convert to Profile or not.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.