Page 1 of 1
version string
Posted: 2006-12-26T08:48:06-07:00
by rmabry
I see that I can get the version string like so:
Code: Select all
$image = new Image::Magick;
print($image->Get('version'));
But the 'version' attribute doesn't appear in the doc file,
http://www.imagemagick.org/script/perl- ... -attribute
Am I on shaky ground using this "undocumented" feature?
Rick
Posted: 2006-12-26T08:59:23-07:00
by magick
The version attribute does appear in the PerlMagick documentation. Look carefully. Its there.
Posted: 2006-12-26T09:20:13-07:00
by rmabry
magick wrote:
The version attribute does appear in the PerlMagick documentation. Look carefully. Its there.
Good grief, I'm going blind. My wife warned me that too much computing would cause this, but did I listen?
Sorry 'bout that.
Rick
Posted: 2006-12-26T12:21:53-07:00
by rmabry
rmabry wrote:
Sorry 'bout that.
But since we're gathered here on this fine Second Day of Christmas, is there a safe way of telling sub-builds apart, say 6.3.1.4 from earlier ones built on the same day, such as 6.3.1.3 (the final digit not being found in the version string)?
Or barring that, suppose my need for doing so is to detect an option for Draw --- call it 'newopt' --- that appeared at some point. What is an elegant way to test for it, other than trying to use it? I can manage this with some overhead by attempting to apply it to a tiny bogus image, but is there another way? The following seems ugly.
Code: Select all
use Image::Magick;
$image = new Image::Magick;
$image->Set(size=>'1x1');
$image->Read('xc:white');
$uhoh = $image->Draw(primitive => 'point', points => '0,0', newopt=>'whatever');
if($uhoh) { do something else... }
Rick
Posted: 2006-12-26T13:36:12-07:00
by magick
There is currently no way to return the sub-release number. In your case you could try
- $x = $image->Get('origin');
and if see if it returns an error.
Posted: 2006-12-26T19:54:25-07:00
by rmabry
magick wrote:
In your case you could try
- $x = $image->Get('origin');
and if see if it returns an error.
How did you know I was trying to use 'origin'?? You really are a wizard, just like your picture.
But seriously, in my case, both of the following return the same thing, namely a blank string. So trying to Get an unknown attribute gives no error?
Code: Select all
$ok = $image->Get('origin');
($ok) ? print("$ok\n") : print("Get(origin) ok\n");
$ok = $image->Get('origami');
($ok) ? print("$ok\n") : print("Get(origami) ok\n");
I presume that 'origin' will soon be a Get-able attribute, but even so, this solution won't quite work for me, since anything pre-origin will also be pre-Get-unknown-attribute-returns-error.
My ugly solution works, though, so I'll use that for now.
Thanks,
Rick
Posted: 2006-12-26T21:39:46-07:00
by magick
Doh! Forgot GetAttribute() cannot return exceptions. This works which I think you suggested anyway:
Code: Select all
use Image::Magick;
$image=Image::Magick->new();
$image->Read('logo:');
$x = $image->Draw(origin=>"+0+0");
warn "$x" if "$x";
$x = $image->Draw(orgami=>"+0+0");
warn "$x" if "$x";
In the mean-time 6.3.2 will be released in a few weeks and you could check for version at 6.3.2 or above which guarentees origin is a valid attribute and a parameter of Draw().