PDA

View Full Version : GIMP Question about PNG Resolution (but CC3 related - sort of..)



jaerdaph
08-17-2011, 04:16 PM
I'm hoping someone more familiar with GIMP than myself might know the answer to this. When I export PNGs from CC3 at 96 dpi, I open them in GIMP so I can rescale them by changing the resolution to 300 dpi. For example, I need to make a 300 dpi poster (that prints at 24" x 18"). I export the PNG 7200 x 5400 pixels and 96 dpi (which would print much larger than 24" x 18" at that resolution) . I open this PNG up in GIMP, reset the resolution to 300 dpi, and I get the 24" x 18" image (still 7200 x 5400 pixels though) I need which I then save as a new PNG. Everything looks fine until I open that new PNG in GIMP again and GIMP says the resolution is now 299.999 dpi. If I check the image properties, it tells me I have a 299 dpi image. Even if I don't open the new image up again in GIMP, image properties still tells me it is 299 dpi. Is this some sort of bug with GIMP, artifact of how CC3 exports PNGs, or am I doing something wrong here?

If any GIMP users/experts out there have an idea what's causing this and how to fix it, I would greatly appreciate it! Thanks again in advance. :)

RobA
08-17-2011, 04:37 PM
You can not fix it, as it is not broken ;)

The PNG spec embedds resolution as:

4.2.4.2. pHYs Physical pixel dimensions

The pHYs chunk specifies the intended pixel size or aspect ratio for display of the image. It contains:

Pixels per unit, X axis: 4 bytes (unsigned integer)
Pixels per unit, Y axis: 4 bytes (unsigned integer)
Unit specifier: 1 byte

The following values are defined for the unit specifier:

0: unit is unknown
1: unit is the meter

When the unit specifier is 0, the pHYs chunk defines pixel aspect ratio only; the actual size of the pixels remains unspecified.

Conversion note: one inch is equal to exactly 0.0254 meters.

So, 300PPI= 300 pixels per 0.0254m, or 11,811.0236 pixels per meter. Since it can't do fractional (unsigned int) it gets rounded:
11,811 pixels/m = 299.9994ppi

jpeg and gif files, on the other hand specify in inches, not meters so they do not have the same issue.

If you have software that claims to create a 300ppi png file it is lying or rounding!

-Rob A>

jaerdaph
08-17-2011, 09:27 PM
I knew someone here would know the answer - thanks Rob! This is exactly why I love (and have missed) this place! :)