Image Magick: read once, make copies
From: david (signdavidup_at_yahoo.com)
Date: 02/25/04
- Next message: Jamie Guay: "Re: "make Makefile.PL" returns "...up to date"; make returns "no target to make""
- Previous message: Jamie Guay: ""make Makefile.PL" returns "...up to date"; make returns "no target to make""
- Next in thread: Martien Verbruggen: "Re: Image Magick: read once, make copies"
- Reply: Martien Verbruggen: "Re: Image Magick: read once, make copies"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Feb 2004 07:58:47 -0800
Hi, I've been searching the archives for an answer to this but
unfortunately the search terms I could think of are rather generic...
I want to read an image into ImageMagick (no problem there) and then
resize it to 4 different sizes, and write the image back out to 4
different files.
So I'd like to avoid re-reading the image 4 times:
# create image objects
my $image = Image::Magick->new;
my $large_image = Image::Magick->new;
my $small_image = Image::Magick->new;
my $tiny_image = Image::Magick->new;
# read same image 4 times
$image->Read('image.jpg');
$large_image->Read('image.jpg');
$small_image->Read('image.jpg');
$tiny_image->Read('image.jpg');
# resize each image
$image->Resize( width => 270, height => 400);
$large_image->Resize( width => 405, height => 600);
$small_image->Resize( width => 101, height => 150);
$tiny_image->Resize( width => 27, height => 40);
I'd like to instead read the image once, and then somehow copy the
$image object, and the image data, to new objects -- wouldn't this
save some overhead? However, I know if I copy $image I'm just going
to get another reference to the original, and I need fresh copies of
the original.
thanks for any help
David Blaikie
- Next message: Jamie Guay: "Re: "make Makefile.PL" returns "...up to date"; make returns "no target to make""
- Previous message: Jamie Guay: ""make Makefile.PL" returns "...up to date"; make returns "no target to make""
- Next in thread: Martien Verbruggen: "Re: Image Magick: read once, make copies"
- Reply: Martien Verbruggen: "Re: Image Magick: read once, make copies"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|