Page 1 of 1

Select rectangular region -- Clone & Crop?

Posted: 2019-08-18T13:30:51-07:00
by Clarke
Hello everyone,,
Is Clone & Crop the only way to get a rectangular region from an image (leaving the original intact)??

(something like
$original=Image::Magick->[whichever way];
$rectangle->Crop(geometry=>'80x80+25+50'); )

Is there a way to get/select a rectangular region without having to clone the whole thing first? Or perhaps the overhead is not as scary as I imagine it might be?

I mean, if you're dealing with 100MB (uncompressed) images, and you want to process 1000 rectangular regions... seems like a waste of CPU

It also seems like, with ImageMagick being so versatile and powerful, it would have a more runtime-efficient alternative.

I haven't thoroughly explored the differences yet, but, on cursory research, GTK2 might do this, with its pixel buffers

Re: Select rectangular region -- Clone & Crop?

Posted: 2019-08-18T15:27:18-07:00
by fmw42
Cloning is not needed in command line. I am not sure why it would be needed in PerlMagick if cropping is all you want to do. The actual input file is not changed by reading it into memory. So you can crop it without affecting the disk file. You can just crop the original and save to a new disk file.

If you have further processing that you want to do, then you may want to clone.

Perhaps I do not understand your final goal.