Page 1 of 1

Updating Imagick

Posted: 2011-06-06T07:10:17-07:00
by BigNate
Hi folks, this is my first post here so I wanted to say thanks for making a place like this accessible.

My problem is a bit strange. I've been working on a local Ubuntu environment with PHP5.3 & ImageMagick 6.6.2-6. My recent task has been to take an existing image, rotate it and place it on top of another image. I have it working great on my machine, with the background of the rotated image keeping its transparency, by using the following code:

Code: Select all

$needle->rotateImage(new ImagickPixel('transparent'), $angle);
where $needle is the image and $angle is the degrees to be rotated. Like I said, it works great on my local set up. I sent it over to my client who then promoted it to their staging server, and the transparent part of the rotated image was black. Not the transparent part of the original image, but the part of the new image that is created by rotating it. I had this happen before, but that was before I knew I could set the background transparency.

The only difference that we've been able to find is that the staging server is running ImageMagick 6.7. I've been trying to upgrade to that, but haven't had much luck. The Ubuntu Synaptic Package Manager shows 6.6 as the most recent version and, while I've been able to download and install 6.7 manually, phpinfo() is still showing 6.6 as the version PHP is using.

So my question is do you guys think it could be my code causing the problems, or should I try and get ImageMagick updated? I don't have access to their staging server, so I'm kind of flying blind at this point. Like I said, the rotate works fine on my machine.. Any help would be greatly appreciated. I'm still fairly new to running PHP on Ubuntu and having access to make changes, so the more details/explanations the better. Thanks for your time!

Nate

Re: Updating Imagick

Posted: 2011-06-19T16:32:43-07:00
by anthony
Note I am not real familar with PHP IMagick API, but I am with IM in general.

More than likely the difference is that $needle image does not have an transparency channel enabled. Without an transparency channel transparent colors come out as black. So either it is the input image, or the processing before this function.

How to ensure transparency is enabled under IMagick? Not sure, but it is probably some 'Matte' function, considering the age of the IMagick interface.

FUTURE...

No one is looking after that PHP API as far as I know, and if it is going to survive the IMv7 changes someone interested in it will need to step up (but probably won't).

The alternative is to move to either 'system calls' of the IM CLI interface, or using a new co-processing method that will be added to IMv7 CLI. That is run ImageMagick in background, to hold images, and have PHP feed it commands on what to do with them. See this raw notes...
http://www.imagemagick.org/Usage/bugs/I ... ipting.txt

Comments to ME welcome.