From: lee dot traynor at skeptic dot de
Operating system: Windows XP SP3
PHP version: 5.3.1
PHP Bug Type: *Graphics related
Bug description: Imagick::distortImage compounds distortion when used
iteratively
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 bug report at http://bugs.php.net/?id=50711&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50711&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50711&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50711&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50711&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50711&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50711&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50711&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50711&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50711&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50711&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50711&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50711&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50711&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50711&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50711&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50711&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50711&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50711&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50711&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50711&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50711&r=mysqlcfg