Am I creating lossless PNG images?

I do image processing in a scientific context. Whenever I need to save an image to my hard drive, I want it to be able to be reopened again and get exactly the data that I had before it was saved. I exclusively use the PNG format, always giving the impression that it is a lossless format. Is it always right if I do not use the wrong depth? If the encoder and decoder do not play any role at all? In particular, the images that I save

  • present as arrays of 2D numpy
  • have integer values ​​from 0 to 255
  • encoded using the OpenCV function imwrite(), for example.cv2.imwrite("image.png", array)
+6
source share
1 answer

PNG is a lossless format for design :

Since PNG compression is completely lossless - and since it supports up to 48-bit TrueColor or 16-bit grayscale - saving, restoring and re-saving an image will not affect its quality, unlike standard JPEG (even for its highest quality settings).

The encoder and decoder should not be important for the correct reading of images. (Assuming, of course, that they are not buggy).

And unlike TIFF, the PNG specification leaves no room for developers to choose and choose which features they will support; the result is that a PNG image saved in one application can be read in any other application that supports PNG.

+2

All Articles