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

New Post: ASP.NET and thumbnail creation

$
0
0
If it is reporting true it is most likely using OpenCL on your processor. But this is only used for a limited set of operations.

You might want to consider to use the Q8 version of Magick.NET to lower the memory usage. This will lower the quality of your images but you will have to test that for yourself if it is an issue in your situation. And I would suggest you to choose either the x86 version or the x64 version instead of the AnyCPU version. There is some extra overhead if you use the AnyCPU version.

Previous versions of Magick.NET did some things in static constructors but this has been removed because it was difficult to manage. There is one internal ImageMagick method that is called when the dll is loaded but that will not cause any issues in a multi-threaded environment. The most important thing is that you should create clones if you are performing multiple operations on one image at the same time. But that should be common sense :) Below is a good and a bad example
int[] sizes = newint[] { 200, 800, 1400 };

using (MagickImage image = new MagickImage())
{
  // Bad kitty
  Parallel.ForEach(sizes, (size) =>
  {
    image.Resize(size, size); // This operates on the same image
    image.Write(size + ".jpg");
  });

  // Good boy
  Parallel.ForEach(sizes, (size) =>
  {
    using (MagickImage clone = image.Clone())
    {
      clone.Resize(size, size);
      clone.Write(size + ".jpg");
    }
  });
}
p.s. You will get the JpegReadDefines class that you can use for 'jpeg:size' in the next release of Magick.NET. This will make the code more cleaner :)

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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