The reason it still 'hangs' is because you are resizing the image after you read it. It will still allocate the memory for an image that is 37017x31865. This worked on my machine but took almost all my 16GB of memory.
You should specify the density before you load the image to get a smaller memory footprint. The following example calculates the best density for an image that fits inside 5000x5000:
You should specify the density before you load the image to get a smaller memory footprint. The following example calculates the best density for an image that fits inside 5000x5000:
string sourceName = "SVG_Image_1.svg"; MagickImageInfo info = new MagickImageInfo(sourceName); // Assume ResolutionX and ResolutionY are the samedouble density = info.ResolutionX; // Maximum width or heightint maxSize = 5000; // Calculate best densitywhile (density > 0.0 && ( (density * (info.Width / info.ResolutionX) > maxSize) || (density * (info.Height / info.ResolutionX) > maxSize)) ) { density--; } MagickReadSettings settings = new MagickReadSettings() { Density = new PointD(density) }; // Load image with the specified settings that will provide you with a smaller imageusing (MagickImage image = new MagickImage(sourceName, settings)) { image.Write("test.png"); }