Faster subimage extraction?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dproc
Posts: 19
Joined: 2010-09-14T20:39:15-07:00
Authentication code: 8675308

Faster subimage extraction?

Post by dproc »

I want to create a new image composed of a small rectangular region from an existing image. I can copy all the pixels of the existing image into a new image and then crop the new image, but I wonder if there is a way to avoid copying all those pixels (I need speed).

I'm working with Magick++ but any command-line ideas will be helpful because they might show me how to do it in Magick++.

And if there's no way to do this, might I suggest a new Image constructor that takes a Geometry describing the source sub-image?

All thoughts, ramblings, help will be appreciated.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Faster subimage extraction?

Post by anthony »

If you need to preserve the original image in memory, why not clone it first, then crop it.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply