Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Magick.NET-7.0.0.0009-Q16-x64-net40-client Freezing System

$
0
0
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:
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");
}

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>