Affine transformation problem

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
Iland

Affine transformation problem

Post 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);
?>

zerbat

Re: Affine transformation problem

Post 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.
Iland

Re: Affine transformation problem

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest