views:

196

answers:

0

I'm trying to create a very large image (86400 x 43200) using several tiles that make up a portion of this final image with ImageMagick (using the .NET bindings).

The problem seems to be when I attempt to create my output image with the given size; ImageMagick just hangs on the Resize() call. When I say 'hangs' I mean the program becomes unresponsive and the CPU/IO/Memory activity drops to zero.

This code works with small images--I've tested on several sets of images that generate a 2048x1024 image and it works flawlessly (and quickly) however it hangs on this large dataset.

Here's my code:

Image a1 = new Image(a1File); // load the first tile

uint outWidth = (uint) (width * 4);    // 4 tiles wide
uint outHeight = (uint) (height * 2);  // 2 tiles high
Image output = new Image(a1);

// ImageMagick hangs here with outWidth = 86400 and outHeight = 43200.
output.Resize(new Geometry(outWidth.ToString() + "x" + outHeight.ToString() + "!"));

output.Composite(a1, 0, 1, CompositeOperator.SrcCompositeOp);
// ... composite many of the other tiles

In the documentation ImageMagick is said to work with gigapixel sized images (of which this is) so it must be able to function with an image this large. Is there a better way to do this or something I'm missing?