What's actually inside an image's DPI tag (and why changing it is lossless)
A print shop rejected a 4000 × 2667 px photo last week because the file "was only 72 DPI". The photo had more than enough pixels for the 8 × 10 in print they were making — at 300 DPI that size only needs 2400 × 3000. Nothing about the image was wrong. One integer in the file header was. This post is about where that integer lives, byte by byte, and why rewriting it doesn't touch a single pixel.…
The DPI tag in an image file is a piece of metadata that indicates the printer's suggested density, not the actual resolution or pixel dimensions. This tag can be found in different formats, such as JPEG, PNG and TIFF, and it lives in a header segment or chunk. When you change the DPI value in the tag, it doesn't affect the actual pixels or compressed data in the image.
The only impact is on how the image is interpreted when it's printed. For example, a file with a 72 DPI tag can be printed at 8 x 10 inches, while the same file with a 300 DPI tag can be printed at 10 x 13.33 inches. The pixels remain the same, and the image's sharpness is unaffected as long as the physical size is what the tag suggests.
The confusion often arises because most image editing software doesn't just change the tag, but also resizes and resamples the image, which can lead to a loss in quality.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.