Page 1 of 1

Affine transformation problem

Posted: 2007-03-15T07:45:11-07:00
by Iland
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);
?>


Re: Affine transformation problem

Posted: 2007-03-20T06:46:35-07:00
by zerbat
I would do a test with a version for command line or Perl first to check if this is really a MagickWand for PHP problem. From the source I can tell that the function itself IS implemented in MW for PHP. So it might be an inherent problem of ImageMagick.

Re: Affine transformation problem

Posted: 2007-03-20T10:54:30-07:00
by Iland
zerbat wrote: I would do a test with a version for command line or Perl first to check if this is really a MagickWand for PHP problem. From the source I can tell that the function itself IS implemented in MW for PHP. So it might be an inherent problem of ImageMagick.

Can anybody check this?