Change in extentImage behavior for new ImageMagick versions?
Posted: 2011-05-11T13:54:15-07:00
Hi all,
I have some IMagick code which uses "extentImage" to pad an image and position it at one corning of the new expanded image. When testing on a system with a newer version of ImageMagick, however, the direction the offsets push the image seems to have changed.
In both cases I am using the same version of IMagick (3.0.1). The differening factor is the version of ImageMagick for which they were built against.
For example, to offset the example "rose" image by 100 pixels down and over, the following works for older versions of ImageMagick:
With newer versions you would need to use "100" instead of "-100" for the x & y offsets to achieve the same effect.
Verion Info:
Old:
Version: ImageMagick 6.6.2-6 2010-12-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
New:
Version: ImageMagick 6.6.9-8 2011-05-05 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
Any ideas why the behavior has changed? I would like to write code that is not dependent on the verison of IM installed. I could probably detect the version installed and use that to decide whether to use positive or negative offsets, but does anyone know of a better way? I know there is a similar method (setImageExtent) but that does not provide support for specifying which direction the padding should occur in.
Thanks,
I have some IMagick code which uses "extentImage" to pad an image and position it at one corning of the new expanded image. When testing on a system with a newer version of ImageMagick, however, the direction the offsets push the image seems to have changed.
In both cases I am using the same version of IMagick (3.0.1). The differening factor is the version of ImageMagick for which they were built against.
For example, to offset the example "rose" image by 100 pixels down and over, the following works for older versions of ImageMagick:
Code: Select all
<?php
header("Content-type: image/png");
$im = new Imagick();
$im->newPseudoImage(70, 46, "magick:rose");
$im->setImageFormat("png");
$im->extentImage(256, 256, -100, -100);
echo $im;
?>
Verion Info:
Old:
Version: ImageMagick 6.6.2-6 2010-12-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
New:
Version: ImageMagick 6.6.9-8 2011-05-05 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
Any ideas why the behavior has changed? I would like to write code that is not dependent on the verison of IM installed. I could probably detect the version installed and use that to decide whether to use positive or negative offsets, but does anyone know of a better way? I know there is a similar method (setImageExtent) but that does not provide support for specifying which direction the padding should occur in.
Thanks,