Changing an Image's DPI Requires Editing Metadata, Not Pixels
Print shops and government forms often require images at 300 DPI, but many people accidentally resample their photos when trying to meet this demand. DPI is actually a metadata value in the file header that tells a printer how many pixels fit in an inch, so the pixel data itself can stay untouched. In PNG files, this value lives in the pHYs chunk, while JPEGs may store it in a JFIF segment, an EXIF segment, or both, which means every existing location should be updated consistently. A developer found that a test suite passed only because the writer and reader shared the same assumptions, and an independent library revealed that PNGs with an eXIf chunk kept a stale value. The key lessons are to update all existing density fields and to verify results with a reader that was not written by the same developer.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in