Re: [Gimp-developer] 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.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]