This is probably a real newbie question - but I've looked around for a good hour and can't find the answer by myself...
I have TIFF-files (about 25MB) and I'd like to extract many individual small crops (like about 2500 per file) from them based on coordinates that I have. At the moment, I've got this (almost) working via the PerlMagick API by doing this:
Code: Select all
$image = Image::Magick->new;
$x = $image->Read('filename.tif');
#and then a loop that is supposed to identify the area with the necessary geometry information:
$IDextract = $image->Crop(geometry=>"${WIDTH}x${HEIGHT}+${HPOS}+${VPOS}");
$x = $image->Write("small_tiffs/$ID.tif");
# end loop
How can I keep the original image in memory so that I don't need to read in the TIFF-file from scratch for every single crop action? I suppose "crop" is not the thing to do - what is a better alternative?
(BTW: I don't mind whether this is via PerlMagick or just the command line...)
Thanks in advance for any pointers!
Sebastian