convert PNG image to sRGB colour space

last modified on 30 July 2019, by Cédric Louvrier

PNG can store many non-critical chunks among the image data and some of them can affect how the image could be rendered on browsers or viewers (e.g. iCCP, which contains ICC profiles). according to what hardware or software you are using, there could be some issues. that is why you can convert the image data itself instead of using color profiles

convert to sRGB (lossy)

pingo could use several ways to do lossy on PNG. it could use lossy filters, doing color quantization or convert image to PNG-8 (palette). whatever the process, the image data is first pre-processed to be converted to sRGB. there is no need to add flags for it since it is done automatically

original file: green-apple-iccp.png (69.91 KB): convert an image to sRGB with additional loss (lossy filter)
original pingo -pngfilter
green apple - original green apple - pingo
69.91 KB 38.71 KB (0.12s) - PNG
iCCP chunk (colors profile) converted to sRGB
original file: iccp-cat.png (22.66 KB): convert an image to sRGB with additional loss (paletted)
original pingo -pngpalette
yellow cat - original yellow cat - pingo
22.66 KB 8.96 KB (0.08s) - PNG
iCCP chunk (colors profile) converted to sRGB

JPG conversion

if you ask for automatic image compression (using -auto or no specific flag) or conversion from PNG to JPG (-jpgconvert), pingo should convert the image data to sRGB colour space

original file: fruits-iccp-noalpha.png (399.12 KB): convert an image to sRGB with additional loss (JPG conversion)
original pingo (default)
fruits - sRGB PhotoShop fruits - sRGB pingo auto
385.09 KB 65.29 KB (0.12s) - JPG
iCCP chunk (colors profile) converted to sRGB

convert to sRGB with no additional loss

if required, the conversion to sRGB should be always lossy because it could change the image data. however, there is no need to add additional loss over the conversion process if you want to preserve PNG as output

original file: iccp-big.png (817.56 KB): convert an image to sRGB without additional loss
PhotoShop pingo -s0 -srgb
screenshot game - sRGB PhotoShop screenshot game - sRGB pingo -s0
2094.41 KB (9.34s) 650.89 KB (1.92s)
converted to sRGB converted to sRGB

-srgb to force the conversion

note that converting the image data could increase or decrease the filesize. if the image data is bigger than original, you should have to use -srgb to force the conversion to sRGB. in this case, pingo should overwrite the file even if file is bigger