RSS/Atom feed Twitter
Site is read-only, email is disabled

How "Print Size" can save pixel density into e.g. png file?

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

5 of 5 messages available
Toggle history

Please log in to manage your subscriptions.

How "Print Size" can save pixel density into e.g. png file? Andrey Utkin 08 May 07:34
  How "Print Size" can save pixel density into e.g. png file? Richard Gitschlag 08 May 15:41
  How "Print Size" can save pixel density into e.g. png file? Mukund Sivaraman 08 May 15:50
  How "Print Size" can save pixel density into e.g. png file? Liam R E Quin 08 May 20:25
   How "Print Size" can save pixel density into e.g. png file? Andrey Utkin 08 May 20:41
Andrey Utkin
2013-05-08 07:34:29 UTC (almost 12 years ago)

How "Print Size" can save pixel density into e.g. png file?

I use the feature of changing image print density (in dpi) in GIMP to get predictable size of printed image. Now i want to do this programmaticaly. I tried to grep the code, but it would take me long time to figure this out by myself. Could please somebody describe in which way png file carries pixel density information, or point to the place in code that actually does this information saving to file. Thanks in advance.
--
Andrey Utkin

Richard Gitschlag
2013-05-08 15:41:08 UTC (almost 12 years ago)

How "Print Size" can save pixel density into e.g. png file?

Date: Wed, 8 May 2013 10:34:29 +0300 From: andrey.krieger.utkin@gmail.com To: gimp-developer-list@gnome.org
Subject: [Gimp-developer] How "Print Size" can save pixel density into e.g. png file?

I use the feature of changing image print density (in dpi) in GIMP to get predictable size of printed image. Now i want to do this programmaticaly. I tried to grep the code, but it would take me long time to figure this out by myself. Could please somebody describe in which way png file carries pixel density information, or point to the place in code that actually does this information saving to file. Thanks in advance.
--
Andrey Utkin
_______________________________________________ gimp-developer-list mailing list
gimp-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-developer-list

Sounds like you need to look at the PNG specs themselves, not necessarily GIMP's method of writing to them:

http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html

Specifically, DPI is encoded into the PNG file in the "pHYs" data chunk, as a pair of 4-byte unsigned integers representing "pixels per unit" along each axis, followed by a single byte specifying the unit of measure (note the only supported unit is "meter", not "inch").

http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.pHYs

-- Stratadrake strata_ranger@hotmail.com
--------------------
Numbers may not lie, but neither do they tell the whole truth. =

Mukund Sivaraman
2013-05-08 15:50:20 UTC (almost 12 years ago)

How "Print Size" can save pixel density into e.g. png file?

Hi Andrey

On Wed, May 08, 2013 at 10:34:29AM +0300, Andrey Utkin wrote:

I use the feature of changing image print density (in dpi) in GIMP to get predictable size of printed image. Now i want to do this programmaticaly. I tried to grep the code, but it would take me long time to figure this out by myself. Could please somebody describe in which way png file carries pixel density information, or point to the place in code that actually does this information saving to file. Thanks in advance.

Look at file-png.c in the GIMP source code tree. See where libpng's png_set_pHYs() function is called in save_image().

Mukund

Liam R E Quin
2013-05-08 20:25:05 UTC (almost 12 years ago)

How "Print Size" can save pixel density into e.g. png file?

On Wed, 2013-05-08 at 10:34 +0300, Andrey Utkin wrote:

I use the feature of changing image print density (in dpi) in GIMP to get predictable size of printed image. Now i want to do this programmaticaly.

Note, you could probably use imagemagick to do this outside GIMP, if that helps.

Liam

Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
Andrey Utkin
2013-05-08 20:41:59 UTC (almost 12 years ago)

How "Print Size" can save pixel density into e.g. png file?

Thanks for all the replies, i've got info i wanted and even more!