I am doing image processing in a scientific context. Whenever I need to save an image to the hard drive, I want to be able to reopen it at a later time and get exactly the data that I had before saving it. I exclusively use the PNG format, having always been under the impression that it is a lossless format. Is this always correct, provided I am not using the wrong bit-depth? Should encoder and decoder play no role at all? Specifically, the images I save
- are present as 2D numpy arrays
- have integer values from 0 to 255
- are encoded with the OpenCV
imwrite()
function, e.g.cv2.imwrite("image.png", array)