Page 1 of 1

Simple Image rotation with transparent background

Posted: 2009-09-10T23:33:34-07:00
by Cadrach
Hi everyone,

I am trying to something quite simple really, rotation with a transparent background. I have tried a lot of things but I keep getting a black background after the rotation

Code: Select all

$img = new Imagick('file.png');
$img->setBackgroundColor(new ImagickPixel("transparent"));
$img->rotateImage(new ImagickPixel('transparent'), 45);
$img->save('fileRotate.png');
Before:
testImageS.png
testImageS.png (27.35 KiB) Viewed 6496 times
After:
testImageS.png
testImageS.png (21.29 KiB) Viewed 6496 times
If you have any idea, please let me know!

Re: Simple Image rotation with transparent background

Posted: 2009-09-10T23:56:09-07:00
by Cadrach
After some more research, I found it:

Code: Select all

$img->distortImage(Imagick::DISTORTION_SCALEROTATETRANSLATE, array(45), true);