affine transform image
Posted: 2009-08-06T11:43:25-07:00
I cannot find any way around the two complementary bugs in Imagick that make it impossible to apply a tranformation matrix to an image.
The affineTransformImage function simply does _nothing_ no matter what parameters I manually provide to it, no matter what the state of the transformation matrix, it simply does nothing. I guess someone forgot to implement it.
But the functionality seems to still exist through ImagickDraw->composite, it's just buggy in that is loses the alpha channel after.
This image is rotated 10 degrees through $draw->rotate(10). As you can see it has ugly aliasing.
Any suggestions?
The affineTransformImage function simply does _nothing_ no matter what parameters I manually provide to it, no matter what the state of the transformation matrix, it simply does nothing. I guess someone forgot to implement it.
But the functionality seems to still exist through ImagickDraw->composite, it's just buggy in that is loses the alpha channel after.
Code: Select all
public function transformImage($img, $x, $y) {
$draw = $this->createDraw();
$draw->composite(Imagick::COMPOSITE_OVER, $x, $y, $img->getImageWidth(), $img->getImageHeight(), $img);
$result = $this->createBuffer();
$result->drawImage($draw);
return $result;
}
Any suggestions?