List Info

Thread: setting "units", odd behavior




setting "units", odd behavior
user name
2005-04-21 14:29:28
I have been experiencing some strangeness trying to set
files where units 
is "Undefined" to "PixelsPerInch".  The
following perl script reproduces 
the behavior on my system, which is running IM 6.2.0:


#!/usr/bin/perl

use Image::Magick;

my $testimg =
Image::Magick->new(size=>"100x100");
$testimg->Read("xc:red");
$testimg->Set(units=>"Undefined");
$testimg->Write("units.png");

# units.png is a 72x72, Undefined units image

my $img = Image::Magick->new;
my $err = $img->Read("units.png");
if($err) {
  die "couldn't read units.png: $err";
}

$img->Set(density=>"300x300");
# removing the following line produces a png with density
300x300 and
# units "Undefined".  including it produces a png
with density 
# 118.11x118.11 and units "PixelsPerCentimeter"
$img->Set(units=>"PixelsPerInch");

$img->Write("units2.png");

_______________________________________________
Magick-users mailing list
Magick-usersimagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
Re: setting "units", odd behavior
user name
2005-04-21 17:34:32
As a further note, I've realized that 300/2.54 = 118.11, so
300 PPI is 
equivalent to 118.11 PPCm.

Beyond that, I'm having trouble getting Photoshop to pay
attention to 
anything I do with the resolution and units fields, which is
really my 
bigger issue.  Can anyone offer suggestions on how I can let
Photoshop 
know my desires in this regard?

On Thu, Apr 21, 2005 at 12:29:28PM -0700, Seamus Campbell
wrote:
  Seamus> I have been experiencing some strangeness
trying to set files where units 
  Seamus> is "Undefined" to
"PixelsPerInch".  The following perl script
reproduces 
  Seamus> the behavior on my system, which is running IM
6.2.0:
  Seamus> 
  Seamus> 
  Seamus> #!/usr/bin/perl
  Seamus> 
  Seamus> use Image::Magick;
  Seamus> 
  Seamus> my $testimg =
Image::Magick->new(size=>"100x100");
  Seamus> $testimg->Read("xc:red");
  Seamus>
$testimg->Set(units=>"Undefined");
  Seamus> $testimg->Write("units.png");
  Seamus> 
  Seamus> # units.png is a 72x72, Undefined units image
  Seamus> 
  Seamus> my $img = Image::Magick->new;
  Seamus> my $err = $img->Read("units.png");
  Seamus> if($err) {
  Seamus>   die "couldn't read units.png:
$err";
  Seamus> }
  Seamus> 
  Seamus> $img->Set(density=>"300x300");
  Seamus> # removing the following line produces a png
with density 300x300 and
  Seamus> # units "Undefined".  including it
produces a png with density 
  Seamus> # 118.11x118.11 and units
"PixelsPerCentimeter"
  Seamus>
$img->Set(units=>"PixelsPerInch");
  Seamus> 
  Seamus> $img->Write("units2.png");
  Seamus> 
  Seamus> _______________________________________________
  Seamus> Magick-users mailing list
  Seamus> Magick-usersimagemagick.org
  Seamus> http://studio.imagemagick.org/mailman/listinfo/magick
-users
_______________________________________________
Magick-users mailing list
Magick-usersimagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )