Do PNGs (or JPGs) have a DPI? Or is it irrelevant when building for retina?

前端 未结 5 1965
梦如初夏
梦如初夏 2020-12-18 20:32

A simple question that I have been having great difficulty finding a definitive answer to: do PNG files have a DPI? Or perhaps more importantly, is it even relevant when bu

5条回答
  •  不思量自难忘°
    2020-12-18 20:51

    PNG does have the ability to store pixels/meter, separately for the X and Y direction, in the PNG "pHYs" chunk. Unfortunately this does not allow exact conversions (72 dpi is 2834.64566929 pixels per meter which is stored as 2835 pixels/meter and when converted back to DPI becomes 72.009); some people find this disturbing.

    JPEG also can store X_density and Y_density, in units pixels/inch or pixels/cm.

提交回复
热议问题