1
votes

So I just wanted to ask this question because there is a quality slider for png in Adobe Photoshop.

Now the reason why I find this very confusing is I know that PNG is a lossless format.

I'm not sure what is used to measure objective quality, by that I mean how much information is contained in images. I'm assuming it's either dpi or bit depth or file size for the same format?

Now, I know that the same lossless compression for the same image can have varying quality (bit depth and dpi).

This is because you can do an in between step and encode it into a lossy format like jpg, before converting back into a lossless format like png.

For example, we have a picture of some dice taken by a camera in a lossless png format it's the original quality let's say 360dpi horizontal and vertical resolution and 24 bit depth.

Then we can encode it into jpg (which is using lossy compression) and presumably the quality would go down slightly from averaging pixels, as it is lossy compression and it would lower the quality to something like 200dpi horizontal and vertical resolution and 12 bit depth.

Then we encode that back into png again (lossless compression) and the final quality would be 200dpi horizontal and vertical resolution and 12 bit depth.

So now we have two pngs for the same image which are in a lossless format, the original one and our one that was encoded from a jpg, that have different quality.

The point I'm trying to make is that I think this is why two images using lossless compression can have differing quality, even though lossless compression does not remove any information, because one of the lossless compression images could have just been encoded from a lossy format. Information can be removed from lossless formats by encoding to and from a lossy format.

So now back to the question, is this why Photoshop has a quality slider for PNG images?

For qualities below 100% say 80%, is Photoshop encoding into something lossy like jpg and then back into the lossless png so that the files can have different quality and thus, a different file size for the same image?

I've also read something on wikipedia about PNG being able to perform lossy compression as well, so is that what is happening instead? https://en.wikipedia.org/wiki/Portable_Network_Graphics#Lossy_PNG_compression

I'm just confused about it.

1

1 Answers

1
votes

Photoshop may be reducing color depth as described in the the wiki you included in your question:

reducing color depth, either:
use a palette (instead of RGB) if the image has 256 or fewer colors,
use a smaller palette, if the image has 2, 4, or 16 colors, or
(optionally) lossily discard some of the data in the original image