Jump to content

Saved PNG physical resolution (DPI)

Recommended Posts


I'm writing a piece of code to read physical pixel size from PNG header and I use images created by Paint.NET to test it.

What I noticed is that Paint.NET never sets unit specifier to 1 in pHYs chunk which according to specification (1) means the resulting PNG does not specify physical pixel dimensions, only pixel aspect ratio.

When opening PNG on the other hand, Paint.NET seems to treat the information stored in pHYs chunk as physical pixel dimensions even though unit specifier is set to 0.

I wanted to ask whether this behavior is intentional for some reason (e.g. because most apps do it that way etc.), or it is something that should be considered as a bug. In other words I'm trying to assess whether it will be safe for us to use information in pHYs chunk no matter what value unit specifier has.

Thanks guys for your opinions - I have minimal experience in this field and your opinion will help me very much.


(1) http://www.w3.org/TR/PNG/#11pHYs

PS: Out of curiosity I just tried to save JPEG using Paint.NET and the unit specifier for DPI in JFIF header is set properly. One more reason to think that the way DPI in PNG is saved is intentional?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...