Page 1 of 1
Change in extentImage behavior between versions?
Posted: 2011-08-25T08:48:31-07:00
by DarkNova
On one of my computers I have ImageMagick 6.6.2-6 and pecl/imagick 3.0.0~rc1-1build1 installed (on Ubuntu 10.10). On this computer if I call extentImage(150, 150, 0, 20) it makes the canvas 150px by 150px and shifts the image DOWN by 20px.
One my other computer I have ImageMagick 6.7.1-10 and pecl/imagick 3.0.1 installed (on CentOS 5.5). On this computer if I call extentImage(150, 150, 0, 20) it makes the canvas 150px by 150px and shifts the image UP by 20px. On this computer I need to call extentImage(150, 150, 0, -20) in order to achieve the same result on the exact same image.
I have been unable to find this change documented. Which behavior is correct? I want to make sure my code is set to the way this will continue working in the future so that it doesn't break on upgrade. Thanks.
Re: Change in extentImage behavior between versions?
Posted: 2011-08-25T09:31:00-07:00
by fmw42
what is your exact command and what is the exact size of your image? do you have -gravity in your command line?
I can confirm in command line IM 6.7.1.10 Q16 (HDRI) that
convert zelda3.jpg -extent 150x150+0+20 zelda3_test1.jpg
causes the image to shift up 20, where the original image is 128x128.
Suggest you post this to the Bugs forum.
Re: Change in extentImage behavior between versions?
Posted: 2011-08-25T10:23:24-07:00
by DarkNova
Thanks, the "extentImage(150, 150, 0, 20)" is actually the call from within PHP, as that is what my application is doing. I just tried running a command line test like you posted and on both computers, the image is shifted up as you described. However, on the computer with ImageMagick 6.6.2-6 and pecl/imagick 3.0.0~rc1-1build1 installed (on Ubuntu 10.10), using positive 20 as the Y parameter from within PHP causes the image to be shifted down, and -20 causes it to be shifted up.
Re: Change in extentImage behavior between versions?
Posted: 2011-08-25T14:14:28-07:00
by fmw42
DarkNova wrote:Thanks, the "extentImage(150, 150, 0, 20)" is actually the call from within PHP, as that is what my application is doing. I just tried running a command line test like you posted and on both computers, the image is shifted up as you described. However, on the computer with ImageMagick 6.6.2-6 and pecl/imagick 3.0.0~rc1-1build1 installed (on Ubuntu 10.10), using positive 20 as the Y parameter from within PHP causes the image to be shifted down, and -20 causes it to be shifted up.
Not sure I follow. In command line mode on IM 6.6.2-6 does +20 shift down? If so, then this should be reported as a bug on the bugs forum as it seems backwards in the current release. You will get more attention to this by the developers if you post to the bugs forum. Make simple post with your example or command line example and link back to this topic.
Re: Change in extentImage behavior between versions?
Posted: 2011-08-25T15:11:31-07:00
by DarkNova
No, in command line mode IM 6.6.2-6 +20 shifts up, like its supposed to. It seems as though it only doesn't work when in combination with pecl/imagick 3.0.0~rc1-1build1.
Re: Change in extentImage behavior between versions?
Posted: 2011-08-25T18:42:52-07:00
by fmw42
DarkNova wrote:No, in command line mode IM 6.6.2-6 +20 shifts up, like its supposed to. It seems as though it only doesn't work when in combination with pecl/imagick 3.0.0~rc1-1build1.
But in command line mode with IM 6.7.1 does it not shift the wrong way (as it does for me). If that is the case, then again, report it on the bugs forum.
Re: Change in extentImage behavior between versions?
Posted: 2011-08-26T18:33:46-07:00
by fmw42
The question is what is the correct (or at least intended) behaviour. For extent, one could look at it as how does the window change relative to the image. So for -extent WxH+X+Y, this may mean that the area of extension is made WxH and moved +X and +Y relative to the image. Thus a 150x150+0+20 mean that the extension window would be made 150x150, but moved down along +Y 20 pixels. This would make it appear that the image was moved up. So it is possible that the intended behaviour was incorrect in the earlier releases and was fixed recently.
This all is just a suspicion. I don't really know how -extent is being defined with respect to the offset terms as it seems to be a hidden parameter not explained at either,
http://www.imagemagick.org/script/comma ... php#extent or
http://www.imagemagick.org/Usage/crop/#extent
You can always put a version trap in your code as a switch as to whether you use +20 or -20 for the given version of IM.
P.S. Looking at the changelog at http://www.imagemagick.org/script/changelog.php, there is an entry:
2010-09-13 6.6.4-2 Cristy <quetzlzacatenango@image...>
Don't negate the geometry offset for the -extent option.
Re: Change in extentImage behavior between versions?
Posted: 2011-08-28T17:23:35-07:00
by DarkNova
OK, thanks, I looked through the changelog but didn't see that entry. It makes sense that that might be where it changed. I actually already put a version switch in -- I was just hoping that someone knew for sure which way was going to be the way going forward, but I will just proceed with the assumption that the recent version is correct.