I have the following imagemagick command line options
-gravity center -background none -extent ${wbg}x${hbg}
which I replicated with the following Imagick code piece but not producing the same result.
$tmpA12->setImageGravity(imagick::GRAVITY_CENTER);
$tmpA12->setImageBackgroundColor(new \ImagickPixel("transparent"));
$tmpA12->extentImage($wbg, $hbg, 0,0);
I believe the setImageGravity is not acting upon the image or the offset 0,0 needs the right value. I am bit stuck here please help me on it
Translate Imagemagick command to Imagick
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Translate Imagemagick command to Imagick
I just posted to stack overflow. See my answer there.
My guess is that extentImage, like cropImage, does not support gravity settings. You will have to compute the center offset from the northwest corner, like you have to in cropImage and use the x,y offsets built into extentImage. However, before you give up on gravity, try http://us3.php.net/manual/en/imagick.setgravity.php (setGravity) rather than setImageGravity.
My guess is that extentImage, like cropImage, does not support gravity settings. You will have to compute the center offset from the northwest corner, like you have to in cropImage and use the x,y offsets built into extentImage. However, before you give up on gravity, try http://us3.php.net/manual/en/imagick.setgravity.php (setGravity) rather than setImageGravity.
Re: Translate Imagemagick command to Imagick
setGravity doesn't work either. Could you give me some tips on computing the offset from the northwest to the image area
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Translate Imagemagick command to Imagick
Did you not do that for cropImage? It is the same for extentImage. See the comments section with switch code for doing that at http://us3.php.net/manual/en/imagick.cropimage.php