php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58648 distortImage: DISTORTION_SCALEROTATETRANSLATE
Submitted: 2009-04-25 11:46 UTC Modified: 2009-04-25 14:32 UTC
From: armin dot a dot ruf at arcor dot de Assigned:
Status: Not a bug Package: imagick (PECL)
PHP Version: 5.2.4 OS: windows nt
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: armin dot a dot ruf at arcor dot de
New email:
PHP Version: OS:

 

 [2009-04-25 11:46 UTC] armin dot a dot ruf at arcor dot de
Description:
------------
I tried to replicate one of the usage examples on the imagemagick site dealing with distorted gradients.
This is my code:
$img = new Imagick();
$img->newPseudoImage( 50, 100, "gradient:" );
$controlPoints = array(	
$img->getImageWidth()/2, $img->getImageHeight()/2, // center
1.0,1.0, // scaleing factors sx, sy
60, // rotation angle
$img->getImageWidth()/2, $img->getImageHeight()/2 // translate to this position
);
$img->distortImage( 3, $controlPoints, false);//Imagick::DISTORTION_SCALEROTATETRANSLATE

The problem occurs in the last statement.
Everthing works fine with the distortion constant 3.
But if I use the distortion constant DISTORTION_SCALEROTATETRANSLATE to execute the SRT-method I get this error:

Fatal error: Uncaught exception 'ImagickException' with message 'invalid argument for option Polynomial : 'Invalid order, should be 1 to 5, or 1.5' @ distort.c/GenerateCoefficients/371' in C:\xampp\htdocs\phptest\imagick\CanvasCreation\simpleGradient.php:149 Stack trace: #0 C:\xampp\htdocs\phptest\imagick\CanvasCreation\simpleGradient.php(149): Imagick->distortimage(7, Array, false)...

It seems that the constant DISTORTION_SCALEROTATETRANSLATE is defined as 7. But it must be 3 as the enumeration shows in distort.h in the magick core files.
 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-25 14:32 UTC] mkoppanen@php.net
Thank you for taking the time to write to us, but this is not
a bug.

The constant is defined in the following way on Imagick side:

IMAGICK_REGISTER_CONST_LONG("DISTORTION_SCALEROTATETRANSLATE", ScaleRotateTranslateDistortion);

It should match the constant from the ImageMagick core.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 09:01:29 2024 UTC