Add a gray .pgm and get a PNG with every gray kept, for the apps and phones that won't open it.
FluffyShieldProtected workspace
From
To
Loading the tool…
The tool didn't load. Reload the page, or check whether an extension or network filter blocks .
Free · No upload · No sign-up · No usage quotas
PNG options here: browser or advanced encoder; RGBA, RGB, grayscale or indexed color; 8- or 16-bit; Fast, Balanced or Maximum compression; interlacing. Which PNG settings are worth changing?
How it works
Each gray is read from the .pgm
→It goes into the PNG unchanged
→You save the PNG
What it does
Same grays, stored as gray
Switching PNG color to Grayscale (no alpha) moves no gray: a pixel that is 128 in the PGM is 128 in the PNG.
Limits A PGM with a pixel brighter than the top value its header allows gets an error, as does one that stops early.
Does the PNG store your gray picture as gray?
Not to start with: it keeps four numbers a pixel, and our gray photo grew. One setting stores one number, as the PGM does.
FluffyBench · 3 min read · Measured on a test photo
Where does the PNG's extra size come from?
A PGM keeps one number for every pixel: how bright it is. A PNG can store a gray picture the same way, but FluffyBench's PNG starts out stored like a color picture with a see-through channel. That's four numbers for every pixel: red, green and blue, which are always equal in a gray picture, and alpha, the see-through level, which here always says solid.
Our gray photo grew by over a quarter as a PNG
PGM12.3 KB
PNG15.8 KB
0481216
File size, KB
The same 128 by 96 gray photo in both files; the PNG was made with the converter's starting settings. How we measured
PNG packs those repeated numbers well, so the file is nowhere near four times the size, but it still ended up bigger than the PGM it came from.
Settings can store it as gray instead. Under More options, PNG color appears once PNG encoding is set to Advanced local encoder, and its Grayscale (no alpha) choice writes one number a pixel, as the PGM does.
Saving the PGM as a gray PNG
Steps 2 to 5 store the PNG as gray; without them you get the starting four numbers a pixel.
Put the .pgm in with Choose images.
Open Settings: behind the gear at the top of the tool on a phone, in the panel next to the tool on a computer.
Open More options.
Change PNG encoding to Advanced local encoder.
Change PNG color to Grayscale (no alpha).
On a phone, close Settings with the gear button. Then run Convert 1 to PNG.
Download the PNG once its card says Done.
Only showing the picture to people?
The picture is for looking at, and nobody will measure its grays.