Affine transformation problem

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
Iland

Affine transformation problem

Post by Iland » 2007-03-12T15:59:54-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);
?>


Post Reply