PNG to JPEG without surprises
Most photographs lose nothing visible in the move from PNG to JPEG at quality 90, and they shrink a lot. A photograph that was saved as a PNG by mistake can be several times larger than it needs to be. How much depends on the quality slider. A 2048 by 1536 photo of 4.9 MB gave 201 KB at quality 50, 342 KB at 75, 683 KB at 90, 1.1 MB at 95 and 2.1 MB at 100. Compared with the PNG, those scored 32.8, 35.2, 39.0, 43.7 and 54.8 dB as PSNR, where higher means closer.
The risks are the ones PNG protects you from. JPEG is lossy, so sharp text, thin lines and flat colour pick up faint noise, and flat graphics can become larger than the PNG. A 1440 by 900 screenshot of 37.8 KB became 70.1 KB at quality 90, 86 percent larger. A 900 by 500 picture of small coloured text went from 62.5 KB to 77.6 KB, then to 145 KB at quality 95 and 253 KB at 100. Its closeness to the PNG jumped from 33.5 dB at 90 to 41.5 dB at 95, because from 95 the encoder keeps colour at full resolution. If the list shows a file growing, keep the PNG, or see PNG to JPG for the quality and background settings in detail.
Does .jpeg or .jpg matter?
For the picture, no. Both endings mean the same format with the same media type, image/jpeg, and every browser and photo program opens either. To prove it on this page we converted one PNG twice, once with each ending: the two files had the same length, 50,178 bytes, and the same content byte for byte.
- Some forms are strict. A few upload forms, content systems and scripts check the ending and accept only one spelling. Use the ending they ask for.
- Case can matter on web servers. Servers on Linux treat photo.JPG and photo.jpg as different names, so an address in a web page must match the file exactly. Keeping every file lower case, with one ending, avoids broken pictures.
- Programs that look at the ending. Some older programs choose how to open a file from its ending. Both endings are well known, so this rarely matters now.
What happens to transparency and colour
A JPEG cannot be see-through. The converter fills every transparent pixel with the colour in the background control before it saves, and soft edges blend into that colour. A dark logo suits white. A light one needs a dark background, or it will vanish.
Colours are converted to sRGB. No colour profile is written, which is what most web and office programs assume. A Display P3 PNG was converted: at quality 100 the JPEG was 50.4 dB from a LittleCMS conversion to sRGB and only 34.7 dB from the unconverted numbers. The picture is also not resized: a 1024 pixel PNG gives a 1024 pixel JPEG. An animated PNG gives its first frame only, and the list says "animated, first frame only" next to it.
Names with spaces, dots and other alphabets
File names are kept exactly, except for the ending. We converted "my logo.final.png" and a file named in German and Japanese characters. The results were "my logo.final.jpeg" and the same name with a .jpeg ending, and the ZIP stored the non-Latin name in the way programs expect for Unicode names.
If two files would get the same name, the ZIP makes them unique by adding a number, so nothing is overwritten.