I'm using the current IM version 6.6.8-0.
With PSD:
Code: Select all
convert rose: -set units PixelsPerInch -set density 100 rose.psd
identify -format "%x x %y" rose.psd
No grave error so far. (IM does write everything into the Photoshop profile, but after that, reads only the density value from there. The units value would come from the XMP profile, but since there's no such profile here, it's Undefined.)
But now:
Code: Select all
convert rose: -set units PixelsPerCentimeter -set density 100 rose2.psd
identify -format "%x x %y" rose2.psd
Double-checked with ExifTool:
Code: Select all
exiftool -S -XResolution -DisplayedUnitsX -YResolution -DisplayedUnitsY rose2.psd
DisplayedUnitsX: cm
YResolution: 254
DisplayedUnitsY: cm
Apparently, IM thinks that the 100 PixelsPerCentimeter need to be converted to a PixelsPerInch value (although PSD of course can store PixelsPerCentimeter, and the PPC unit is even written to DisplayedUnitsX and DisplayedUnitsY). So, now it's 254 PixelsPerCentimeter instead of 100 PixelsPerCentimeter. And for the 'XResolution', it's somehow half of that value (127). Very strange..
And a small problem with PNG:
Code: Select all
convert rose: -set units PixelsPerInch -set density 300 rose.png
convert rose.png rose2.png
identify -format "%x x %y" rose2.png
Also strange - but can be explained. In the first file, of course the correct value of 118.11 PixelsPerCentimeter gets written into the pHYs chunk (as it can't be PixelsPerInch). But: "-set density" also sets an artifact and this gets written as additional "density" tEXt chunk (with value 300). When again reading that file, the density value from the "density" chunk takes precedence over that from the pHYs chunk, and so it's suddenly 300 PixelsPerCentimeter - and the pHYs chunk also gets updated with that. And later density changes from of e.g. "-density" or "-resample" always get overridden with that initial density chunk...
Of course a very small problem.. and I know how to circumvent it. But maybe "-set density" shouldn't automatically create a "density" chunk (just like "-set units" doesn't automatically create a "units" chunk)?