problem with gravity not working

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
notbob

problem with gravity not working

Post by notbob »

I have 2 servers.
One uses an old version of image::magick (5 something)
One uses 6.2.6.

On the old version, the gravity feature in composite works just fine.
On my 6.2.6 version, it always defaults to the northwest, regardless of the setting.
Since the default for gravity is northwest, it almost makes me think it is not even seeing what I am setting it to. I have tried using the same script that work on the old 5 version, but still no success.

Any suggestions?

Thanks
NB
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: problem with gravity not working

Post by anthony »

scripts from v5 often will not work in v6 as you need to do things in the right order. Operator order was a major problem and the cause of lots of issues in IM v5 which was why things changed and the major version number changed.
see IM Examples 'Basics' for more details.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
notbob

Re: problem with gravity not working

Post by notbob »

Thanks for the reply. I probably should have added the code I am using:

my $image2 = new Image::Magick;
$image2->Read($copyrightFile);
$q->Composite(image=>$image2, gravity => "SouthEast");


I looked at the examples, and maybe I am missing something that has changed, but I thought the above should work. However, the watermark still shows at Northwest?

If I am doing something wrong, please let me know.
Thanks!
Nb
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: problem with gravity not working

Post by magick »

We are using ImageMagick 6.3.7-2, the current release. The following script places the rose in the lower right hand corner of the ImageMagick logo as expected:
  • use Image::Magick;

    my $image = Image::Magick->new;
    $image->Read('logo:');
    my $logo = Image::Magick->new;
    $logo->Read('rose:');
    $image->Composite(image=>$logo, gravity => "SouthEast");
    $image->Display();
notbob

Re: problem with gravity not working

Post by notbob »

Thanks for the posts.
I tried the code listed and it still did not work.
On the server that had version 6.3.5 - I upgraded it to the current version and then it worked.
The current version also works with the code I am using on my old server with version 5.x on it.

Seems to me that there is a bug in version 6.3.5 with composite and gravity, but since it has been addressed in the 6.3.7, I guess it does not matter.

Thanks again!
NB
Post Reply