How PNG stores DPI
PNG does not use dots per inch. It stores pixels per meter in the pHYs block, and the unit is flagged as meters. The tool converts for you. 300 DPI is written as 11,811 pixels per meter, and 72 DPI as 2,835.
Many apps leave this block out. A PNG without it has no DPI, and some programs then assume 72 or 96. Adding the block gives print programs a clear value.
What stays the same
The pixels, the color profile, the transparency and every other block of the file stay as they were. The tool removes any old pHYs block, adds one new block before the image data, and copies the rest byte for byte.
This is different from exporting the image again. A new export can change the compression, the color profile or the bit depth. Editing the header cannot.
Screenshots and exports
Screenshots on a Retina Mac often carry 144 DPI. Design apps export at 72. Neither value is wrong for a screen. If a print shop asks for 300 DPI, set it here and upload the new file.
When a PNG is not the right file
PNG files of photos can be very large. For a print shop that accepts JPEG, a high quality JPEG is often much smaller. Use PNG for flat graphics, logos, text and anything with transparency.
Questions
- Does changing PNG DPI change the file size?
- Only by a few bytes. The tool adds one 21 byte block and removes any old one.
- Is transparency kept?
- Yes. The picture data is not decoded, so the alpha channel is untouched.
- Why does my PNG show no DPI?
- Many programs write no pHYs block. The row says "not set" in that case. Choose a value and download the file to add one.