php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59095 setGravity() and setImageGravity() have no effekt on compositeImage()
Submitted: 2010-03-02 12:22 UTC Modified: 2010-03-12 18:16 UTC
Votes:3
Avg. Score:3.7 ± 0.9
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: mail+pecl at rodneyrehm dot de Assigned:
Status: Suspended Package: imagick (PECL)
PHP Version: 5.3.1 OS: Mac OS X 10.6.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
28 - 20 = ?
Subscribe to this entry?

 
 [2010-03-02 12:22 UTC] mail+pecl at rodneyrehm dot de
Description:
------------
The following command places the watermark.png nicely in the lower right corner of original.jpg:
composite -gravity SouthEast -geometry "+0+0" 'watermark.png' 'original.jpg' 'output.jpg'

Trying the to get the same result with Imagick fails, though:
<?php

$wm = new Imagick( 'watermark.png' );
$im = new Imagick( 'original.jpg' );
$im->setImageGravity( Imagick::GRAVITY_SOUTHEAST );
$im->compositeImage( $wm, Imagick::COMPOSITE_DEFAULT, 0, 0 );
$im->writeImage( 'output.jpg' );

?>

Doing a <?php var_dump( Imagick::GRAVITY_SOUTHEAST, $im->getImageGravity() ); ?> gives me ?int 9, int 9? - which tells me the gravity is set properly.

Thus I guess compositeImage() simply ignores the gravity attribute.

Some info from phpinfo():
imagick module version: 2.3.0 
ImageMagick version: ImageMagick 6.6.0-0 2010-03-02 Q16


Reproduce code:
---------------
<?php

$wm = new Imagick( 'watermark.png' );
$im = new Imagick( 'original.jpg' );
$im->setImageGravity( Imagick::GRAVITY_SOUTHEAST );
$im->compositeImage( $wm, Imagick::COMPOSITE_DEFAULT, 0, 0 );
$im->writeImage( 'output.jpg' );

?>

Expected result:
----------------
watermark.png placed in bottom right corner on top of original.jpg

Actual result:
--------------
watermark.png placed in top left corner on top of original.jpg

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-02 17:12 UTC] mail+pecl at rodneyrehm dot de
I just tested the issue with Imagick 3.0.0RC1 and got the same (wrong) result.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 17 10:03:37 2021 UTC