i'm trying to accomplish some perspective distortion, but it doesn't seem to work as i imagine, so i'll post here the example that is supposed to work. it can be reviewed at http://www.imagemagick.org/Usage/distorts/. i'll take the chessboard example. the source image is the following:

the command line transformation:
Code: Select all
convert checks.png -matte -virtual-pixel transparent \
-distort Perspective '0,0,0,0 0,90,0,90 90,0,90,25 90,90,90,65' \
checks_pers.png

now, using php and the Imagick extension, i suppose that transforms into the following code:
Code: Select all
<?php
$testImagick = new Imagick("checks.png");
$testImagick->setImageMatteColor(new ImagickPixel("transparent"));
$testImagick->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT);
$testImagick->distortImage(Imagick::DISTORTION_PERSPECTIVE, array(0,0,0,0, 0,90,0,90, 90,0,90,25, 90,90,90,65), false);
$testImagick->writeImage("checks_distorted.png");
$testImagick->destroy();
?>

which is not what i am looking for. changing the bestfit parameter to true doesn't change the fact that the background stays yellow instead of transparent.
what's weird also: if i run the command line example, what i get is a square filled 100% yellow (checks are gone). i tried several imagemagick versions, including the svn trunk of imagemagick, since i noticed some distortion.c changes recently. for imagick, i always used the cvs version.
any hints would be greatly appreciated.
cheers,
-f3k.