php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59026 distortImage compounds distortion when used more than once
Submitted: 2010-01-10 07:37 UTC Modified: 2010-02-28 07:42 UTC
From: lee dot traynor at skeptic dot de Assigned:
Status: No Feedback Package: imagick (PECL)
PHP Version: 5.3.0 OS: Windows XP SP3
Private report: No CVE-ID: None
 [2010-01-10 07:37 UTC] lee dot traynor at skeptic dot de
Description:
------------
When used iteratively, imagick:distortImage compounds the distortion on the image from one image to the next.


Reproduce code:
---------------
<?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);
	$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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-27 15:13 UTC] mkoppanen@php.net
Hi, 

I am unable to reproduce this issue on linux. What version of Imagick are you running?
 [2010-02-28 07:42 UTC] mkoppanen@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 02:01:27 2024 UTC