[magick-users] Replicating an image within an image object

David N. Lombard dnl at speakeasy.net
Sat Jan 17 13:17:22 PST 2009


duc.sequere.aut.de.via.decede at imagemagick.org wrote:
>> Clone() wants to generate a new image object
> 
>   my $images=Image::Magick->new();
>   my $image=Image::Magick->new();
>   $image->Read( $inf ); 
>   push(@$images,$image->Clone());
>   push(@$images,$image->Clone());
>   push(@$images,$image->Clone());
>   push(@$images,$image->Clone());
>   my $montage = $images->Montage( tile=>"2x2", ... );
>   $montage->Write( $outf );
> 
> Clone() only clones the image properties, not the image pixels so its a
> light-weight process.

Ah, that did it.  Here's my final loop:

   push @$image, $image->[$i++]->Clone() while $n++ < $w*$h;

If I had cloned the whole thing, another response suggested I'd end up 
with binary growth--makes sense to me...

-- 
David N. Lombard


More information about the Magick-users mailing list