ID: 50711
Updated by: [email protected]
Reported By: lee dot traynor at skeptic dot de
-Status: Open
+Status: Bogus
Bug Type: *Graphics related
Operating System: Windows XP SP3
PHP Version: 5.3.1
New Comment:
Report pecl's extension to pecl.php.net
Previous Comments:
------------------------------------------------------------------------
[2010-01-10 10:16:35] lee dot traynor at skeptic dot de
Description:
------------
When used ieteratively, imagick:distortImage compounds the distortion
on the image from one image to the next.
Reproduce code:
---------------
---
>From manual page: function.imagick-distortimage
---
<?php
# $grfile is a panoramic image; $incr is the displacement in
pixels/interation
$grfile = "Canadas.png";
$incr = 10;
# For some strange reason, "new" requires the tiemzone to be set
date_default_timezone_set ("Europe/Berlin");
$imsrc = new Imagick ($grfile);
$srcwidth = $imsrc->getImageWidth ();
$srcheight = $imsrc->getImageHeight ();
$image_type = $imsrc->getImageFormat ();
$subdir = substr ($grfile, 0, strpos ($grfile, "."));
if (!is_dir ($subdir)) mkdir ($subdir);
$aspectratio = 4/3;
$destwidth = floor ($srcheight * $aspectratio);
$imax = ceil ($srcwidth - $destwidth) / $incr;
$dx = $dy = -0.02;
$distort = array (0.0, 0.0, $dx, 1 - $dx * $aspectratio, 0.0, 0.0, $dy,
1 - $dy);
for ($i = 0; $i < $imax; $i++)
{
set_time_limit (10);
$imdest = $imsrc->clone ();
$file_dest = $subdir . "\\" . sprintf ("%04u", $i) . "." .
$image_type;
$start = round ($i * $incr);
$imdest = $imsrc->clone ();
$imdest->cropImage ($destwidth, $srcheight, $start, 0);
$imdest->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_GRAY);
$imdest->distortImage (imagick::DISTORTION_BARREL, $distort, true);
$imdest->writeImage ($file_dest);
$imdest->destroy ();
}
$imsrc->destroy ();
?>
Expected result:
----------------
A series of images with identical barrel distortions.
Actual result:
--------------
A series of images with the distortion increasing from one image to the
next.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50711&edit=1