Page 1 of 1

Enlarging the canvas

Posted: 2007-12-17T02:30:44-07:00
by maxgraphic
Hello. I'm sorry if this has been answered elsewhere, but I've haven't had any luck finding a solution.

I'm trying to enlarge the canvas of an existing image. It seems that Crop will reduce the canvas, but not enlarge it, even with judicious use of exclamation marks. I don't want to scale the image itself, just the canvas or page size. Along the lines of Photoshop's "Canvas Size" feature.

More specifically, I'm trying to "embolden" an image by compositing it with itself, offset one pixel. This part works:

my $image = Image::Magick->new;
$image->Read($fn);
my $image2 = $image->Clone;
$image->Composite(compose => 'Darken', x => 1, y => 0, image => $image2);

But I'd like to add one pixel to the width of $image so that the final column is duplicated.

Thanks in advance!

Max

Re: Enlarging the canvas

Posted: 2007-12-23T18:34:57-07:00
by RetroJ
You want Extent.

Re: Enlarging the canvas

Posted: 2007-12-23T18:38:49-07:00
by maxgraphic
RetroJ wrote:You want Extent.
I agree. Unfortunately, $image->Extent gives me:

[error] Can't locate auto/Image/Magick/Extent.al in @INC (@INC contains: /home/max /etc/perl /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl /usr/local/lib/perl/5.8.3 /usr/local/share/perl/5.8.3 /usr/local/lib/perl/5.8.0 /usr/local/share/perl/5.8.0 . /etc/apache/ /etc/apache/lib/perl) at Item2.pm line 3642

Is it something I need to install separately?

Thanks for your response.

Re: Enlarging the canvas

Posted: 2007-12-24T07:56:45-07:00
by RetroJ
I can only guess that you are running an old PerlMagick.

Re: Enlarging the canvas

Posted: 2008-02-05T17:49:01-07:00
by anthony
You could try using splice with appropriate gravity options to add the one pixel column and row. It is a older function than extent.

Before that function the best method would be to append a single pixel image to the existing image.

Sorry I do not use PerlMagick often enough to know the function calls without looking them up myself.