Affine transformation problem
Posted: 2007-03-15T07:45:11-07:00
What's wrong? I try to transform an image, and I have no effect at all. Looks like MagickAffineTransformImage have no effect with any parameter values... ImageMagick 6.3.3... Last versions of MagickWand on windows and linux...
Code: Select all
<?php
$ptrn=NewMagickWand();
MagickReadImage($ptrn,'pattern.tif');
$pw=NewPixelWand();
PixelSetColor($pw,'black');
PixelSetAlpha($pw,0);
PixelSetOpacity($pw,0);
// only for test purposes - this transfomation works.
MagickShearImage($ptrn,$pw,15,0);
// only for test purposes - this transformation works on linux and hangs php on windows.
MagickRotateImage($ptrn,$pw,45);
$atdw=NewDrawingWand();
DrawAffine($atdw,
floatval($_GET['sx']),
floatval($_GET['sy']),
floatval($_GET['rx']),
floatval($_GET['ry']),
floatval($_GET['tx']),
floatval($_GET['ty']));
if (WandHasException($atdw)) // it also works and didn't show an error
{
$r=DrawGetException($atdw);
print_r($r);exit;
};
$r=MagickAffineTransformImage($ptrn,$atdw); //this does nothing and no errorcode returns...
if (!$r||WandHasException($ptrn))
{
echo MagickGetExceptionString($ptrn);
exit;
};
//MagickCompositeImage($ptrn,$mw,MW_OverCompositeOp,0,0); /// old code fragment, there was some image compositing, it works good
$nw=$ptrn;
if (!$nw)
{
echo MagickGetExceptionString($nw);
exit;
};
MagickSetImageFormat($nw,'JPG');
MagickEchoImageBlob($nw);
?>