Page 1 of 1
Stitching together a large image with Magick++
Posted: 2016-08-03T08:31:41-07:00
by Acorn
Hello, everyone!
I am currently attempting to stitch together many images into one large image. Because of the 32-bit restrictions, I can not allocate enough memory to hold the entire image.
A coworker pointed me to the ImageMagick library, because "ImageMagick utilizes multiple computational threads to increase performance and can read, process, or write mega-, giga-, or tera-pixel image sizes."
My question is, is it possible to stitch together a couple hundred images that I can not do manually because of the 32-bit limit?
I've looked through the API, and I could not come to a clear answer.
It looks like I would have to generate my background image, and then use the composite function to stitch all of the images onto it.
Re: Stitching together a large image with Magick++
Posted: 2016-08-03T08:43:56-07:00
by snibgo
What "32-bit restrictions"? If your computer has a 2^32 limit on filesizes, IM won't overcome that.
IM can create and process images that are too large to fit in memory. However, there is a big performance penalty because disk is much slower than memory.
Re: Stitching together a large image with Magick++
Posted: 2016-08-03T09:03:10-07:00
by GeeMack
Acorn wrote:It looks like I would have to generate my background image, and then use the composite function to stitch all of the images onto it.
Compositing onto a background is one way to approach that, but there are other, often more effective ways to attach images to each other with ImageMagick, aligned side by side horizontally or vertically, with specific overlaps or offsets or spacing, just about any way you can imagine.
Re: Stitching together a large image with Magick++
Posted: 2016-08-08T07:19:05-07:00
by Acorn
snibgo wrote:What "32-bit restrictions"? If your computer has a 2^32 limit on filesizes, IM won't overcome that.
IM can create and process images that are too large to fit in memory. However, there is a big performance penalty because disk is much slower than memory.
Yes, that is what I was alluding to. I know that there will be a performance hit, but I don't really have a choice at this point. I can't do 64-bit, so I'm stuck with 32-bit. If they want these obscenely large images mosaicked together, then I'm going to have to operate off of disk.
Could you point me in the right direction w/r/t the C function I should look at?
GeeMack wrote:Acorn wrote:It looks like I would have to generate my background image, and then use the composite function to stitch all of the images onto it.
Compositing onto a background is one way to approach that, but there are other, often more effective ways to attach images to each other with ImageMagick, aligned side by side horizontally or vertically, with specific overlaps or offsets or spacing, just about any way you can imagine.
Am I able to do this off of disk rather than in-memory?
Re: Stitching together a large image with Magick++
Posted: 2016-08-08T08:02:24-07:00
by snibgo
Could you point me in the right direction w/r/t the C function I should look at?
To do what? There are C functions that correspond to most command-line options. For example, "-append" at the command line uses image.c function AppendImages().
Sometimes, a C program gives far better performance than a complex script because it can save on filesystem reads and writes. But for simple appends or composites from a number of inputs, there is probably no benefit.