Cannot set units to pixelsperinch?
Posted: 2014-02-13T06:45:05-07:00
I looked a bit at this post, ImageMagick • View topic - -size -density -units - and I tried to come up with a command line, which could set "PixelsPerInch" as units it output image (as read by `identify`). But no matter what order of arguments I use (or which case is used for "pixelsperinch" ), it seems I only get "Units: Undefined" or "Units: PixelsPerCentimeter" - but I never get "PixelsPerInch"??
My platform:
For example, this is the kind of results I get:
... which were obtained with the following `bash` script:
What am I doing wrong? Or is this possibly a bug?
Many thanks in advance for any answers,
Cheers!
My platform:
Code: Select all
$ convert --version
Version: ImageMagick 6.6.2-6 2012-08-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
$ echo $(cat /etc/issue) $(uname -a)
Ubuntu 11.04 \n \l Linux mypc 2.6.38-16-generic #67-Ubuntu SMP Thu Sep 6 18:00:43 UTC 2012 i686 i686 i386 GNU/Linux
Code: Select all
convert -size 100x100 xc:red test.png
Geometry: 100x100+0+0
Resolution: 72x72
Print size: 1.38889x1.38889
Units: Undefined
convert -size 100x100 xc:red -units PixelsPerInch test.png
Geometry: 100x100+0+0
Resolution: 28.34x28.34
Print size: 3.52858x3.52858
Units: PixelsPerCentimeter
convert -size 100x100 -units PixelsPerInch xc:red test.png
Geometry: 100x100+0+0
Resolution: 28.34x28.34
Print size: 3.52858x3.52858
Units: PixelsPerCentimeter
convert -size 100x100 xc:red -units PixelsPerInch -density 72 test.png
Geometry: 100x100+0+0
Resolution: 28.34x28.34
Print size: 3.52858x3.52858
Units: PixelsPerCentimeter
convert -size 100x100 xc:red -density 72 -units PixelsPerInch test.png
Geometry: 100x100+0+0
Resolution: 28.34x28.34
Print size: 3.52858x3.52858
Units: PixelsPerCentimeter
convert -size 100x100 xc:red -set units PixelsPerInch test.png
Geometry: 100x100+0+0
Resolution: 72x72
Print size: 1.38889x1.38889
Units: Undefined
convert -size 100x100 -set units PixelsPerInch xc:red test.png
Geometry: 100x100+0+0
Resolution: 72x72
Print size: 1.38889x1.38889
Units: Undefined
convert -size 100x100 -units PixelsPerInch xc:red -set units pixelsperinch test.png
Geometry: 100x100+0+0
Resolution: 28.34x28.34
Print size: 3.52858x3.52858
Units: PixelsPerCentimeter
convert -size 100x100 -set units PixelsPerInch xc:red -units pixelsperinch test.png
Geometry: 100x100+0+0
Resolution: 28.34x28.34
Print size: 3.52858x3.52858
Units: PixelsPerCentimeter
Code: Select all
INimg="xc:red"
OUTIMG="test.png"
# ppi="pixelsperinch"
ppi="PixelsPerInch"
for icmd in \
"convert -size 100x100 $INimg $OUTIMG" \
"convert -size 100x100 $INimg -units $ppi $OUTIMG" \
"convert -size 100x100 -units $ppi $INimg $OUTIMG" \
"convert -size 100x100 $INimg -units $ppi -density 72 $OUTIMG" \
"convert -size 100x100 $INimg -density 72 -units $ppi $OUTIMG" \
"convert -size 100x100 $INimg -set units $ppi $OUTIMG" \
"convert -size 100x100 -set units $ppi $INimg $OUTIMG" \
"convert -size 100x100 -units $ppi $INimg -set units pixelsperinch $OUTIMG" \
"convert -size 100x100 -set units $ppi $INimg -units pixelsperinch $OUTIMG" \
;
do
echo $icmd ;
$icmd ;
identify -verbose $OUTIMG | grep 'Geometry:\|Resolution:\|Print size:\|Units:' ;
done
Many thanks in advance for any answers,
Cheers!