views:

118

answers:

2

I am trying to use ImageMagick to extent an image a little bit:

my $image = Image::Magick->new;
open( IMAGE, $filename );
$image->Read( file => \*IMAGE );
close(IMAGE);

$image->Extent( gravity => 'Center', width => 150, height => 150, );

$image->Write( $outfile );

while the the image is extented to the correct size, it is not in the middle. Am I using this correctly?

Update:

I also tried using the unwieldy version:

$image->Set( Gravity => 'Center' );

but still no good. I am using version 6.5.8-10.

2nd Update:

Found this in PerlMagick's changelog:

2009-10-18  6.5.7-0 Cristy  <quetzlzacatenango@image...>
  * Interpret gravity properly for ExtentImage().
A: 

This page will help you to solve your problem and even perform even more functions on the image.

http://www.imagemagick.org/Usage/annotating/

Prashant
A: 

Seems like a bug, as convert outside Perl works.

Timmy