Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
i want to do image transformMatrix in php any idea how to ?
using Imagick or else ??


$thumb = new Imagick('download.png');

$thumb->resizeImage(524,524,Imagick::FILTER_LANCZOS,1);
$thumb->setResolution(360,360);
$thumb->affineTransformImage(1, 0.4, -0.6, 0.6, 71, 0);

$thumb->writeImage('download3.png');

$thumb->destroy();


it gives error
Argument 1 passed to Imagick::affinetransformimage() must be an instance of ImagickDraw
Posted

1 solution

What could be unclear in this error message? This is so clearly explained here: http://www.php.net/manual/en/imagick.affinetransformimage.php[^].

You did not construct matrix, supplied 6 numeric arguments instead of one ImagickDraw $matrix. And then see how to initialize the matrix you need: http://www.php.net/manual/en/class.imagickdraw.php[^].

—SA
 
Share this answer
 
Comments
garav kumar mishra 13-Mar-14 0:45am    
i wrote
$thumb = new Imagick('download.png');

$thumb->resizeImage(524,524,Imagick::FILTER_LANCZOS,1);
$thumb->setResolution(360,360);
$thumb->affineTransformImage(ImagickDraw (1, 0.4, -0.6, 0.6, 71, 0));

$thumb->writeImage('download3.png');

$thumb->destroy();
still getting error ?
Sergey Alexandrovich Kryukov 13-Mar-14 2:02am    
Create ImagickDraw instance and pass your parameters (if they are correct) to affine: http://www.php.net/manual/en/imagickdraw.affine.php...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900