php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #58110 ImagickDraw translation behaviour erratic
Submitted: 2008-03-20 03:10 UTC Modified: 2008-03-20 05:31 UTC
From: thetourist at gawab dot com Assigned:
Status: Wont fix Package: imagick (PECL)
PHP Version: 5.2.1 OS: Ubuntu 7.10
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-03-20 03:10 UTC] thetourist at gawab dot com
Description:
------------
I am doing some picture composition with imagick in PHP. I translate the image before I do the composition. Depending on the amount of translation, I can get the image or the script fails. If I translate +1000 in the horizontal direction I get a valid image. If I translate -1000 units, the script fails and I get a zero size result.

I am using Imagick 2.1.1, Ubuntu 7.10, PHP Version 5.2.3, Apache 2.2.4, ImageMagick 6.2.4.

Any ideas would be appreciated.

As to why I want to translate by -1000, I am doing some map alignment affine transforms and they can be quite complex - this is just a test case.

Regards,

TimSC

Reproduce code:
---------------
<?php 
	//phpinfo();

	//Create a blank blue image
	$image = new Imagick();
	$col = new ImagickPixel();
	$col->setColor  ("blue");
	$image->newImage( 640, 480, $col );
	$image->setImageFormat( 'png' );
	
	//Create a small green image
	$col->setColor  ("green");
	$image2 = new Imagick();
	$image2->newImage( 100, 100, $col );
	$image2->setImageFormat( 'png' );
	
	//Composit green image onto blue image
	$ImagickDraw = new ImagickDraw();
	$ImagickDraw->translate(-1000.0,0.0); //Translation step
	$ImagickDraw->composite(imagick::COMPOSITE_OVER,0,0,-1,-1,$image2);
	$image->drawImage( $ImagickDraw );

	//Output image
	header( "Content-Type: image/{$image->getImageFormat()}" );
	echo $image->getImageBlob( );
?>

Expected result:
----------------
Ideally the code example would return a valid image. Any composite that has been translated outside the image bounds should not be displayed.

Or if that is not possible, I would expect Imagick to throw an exception if there was a problem rather than just silently failing.

Actual result:
--------------
Script appears to stop running when I call ImageickDraw::drawImage(...). A zero size file is returned to the browser.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-20 04:11 UTC] mkoppanen@php.net
I am testing with ImageMagick 6.3.9 and the latest Imagick. Seems like the image is returned correctly. This migth be a bug in earlier ImageMagick versions.
 [2008-03-20 05:31 UTC] thetourist at gawab dot com
I have bitten the bullet and installed 6.3.9 from source. This fixed the problem, thanks!  

Looks like the repo for hardy heron 8.04 beta is still using the broken version 6.2.4. It would have been nice for an exception to be thrown if imagemagick returns invalid data to Imagick but I suppose that is a separate issue.

TimSC
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 09:01:26 2024 UTC