Search code examples
deep-learningpngjpeg

Is there any loss of information in converting jpg files to png?


I am working on an image dataset using deep learning for segmentation. The training images and masks are in jpg format. I would like to know whether there is any loss of information in converting jpg to png? I searched a bit, but couldn't get any relevant information. I am trying out whether using png images improves segmentation accuracy. Any help is appreciated.


Solution

  • PNG uses a lossless compression per default.

    However, the PNG standard supports many different bit depths, color spaces and nifty features that can result in information loss. For example if you use a standard JPEG file with 24bit color and convert it to a PNG with 8bit color, you will lose image information.

    When using default settings in libraries such as OpenCV or PIL, the conversion will be lossless though.