Preferred value to encode 96 DPI within PNG

Viewed 218

PNG files may contain chunks of optional informations. One of these optional information blocks is the physical resolution of the image (chunk-signature pHYs).[1] [2] It contains separate values for horizontal and vertical resolution as pixels per unit, and a unit specifier, that can be 0 for unit unspecified, or 1 for meterthat's quite confusing, because resolutions are traditionally expressed in DPIs.

The Inch is defined as 25.4 mm in the metric system. So, if I calculate this correctly, 96 DPIs means 3779.527559... dots per metre. For the pHYs chunk, this has to be rounded. I'd say 3780 is the right value, but I found also 3779 suggested on the web. Images of both kind also coexist on my machine.

The difference may not be important in most cases,

3779 * 0.054 = 95.9866
3780 * 0.054 = 96.012

but I try to avoid tricky layout problems when mixing images of both kind in processes that are DPI-aware like creating PDF files using LaTeX.


[1] Portable Network Graphics (PNG) Specification (Second Edition), section11.3.5.3 pHYs Physical pixel dimensions

[2] PNG Specification: Chunk Specifications, section 4.2.4.2. pHYs Physical pixel dimensions

1 Answers
Related