Reuse imagemagick process instance in asp.net app
<p>Well, creating thumbnail images in an asp.net app seems more painful then I ever thought.</p>

<p>I first used System.Drawing stuff but then I was not satisfied with the amount of code I had to write just to do some simple resizing on a fixed canvas, then I read about the controversial discussed warning by Microsoft that System.Drawing might or might not work in asp.net web context and lastly the performance of Bitmap operations was rather bad. </p>

<p>So I switchted to Imagemagick (IM) in order to generate thumbnails. This works pretty well actually as I have experience in working with IM in PHP and creating a new System.Diagnostics.Process is a simple operation. </p>

<p>However, when I need to generate many thumbs in one request (30 or more) the CPU usage goes through the roof (100%) and stays there until the last thumb is created. Of course the images are cached once they are written but still - this worries me as there are other application on the server which should not hang forever when some uncached thumbs are created.</p>

<p>If you are not familiar with Imagemagick, here is an example of how I use it:</p>

<pre><code>/path/to/im/convert.exe large.jpg ...some options... small.png
</code></pre>

<p>So for each image I create new convert.exe instance (via new System.Diagnostics.Process), and thats what probably puts so much CPU load on the server. Is there any better way to do this? Switching from Imagemagick to another image creation solution is not an option.</p>

<p>PS: Yes, this is a followup to my previous question <a href="http://stackoverflow.com/questions/1422392/imagemagick-in-asp-net-via-command-line">http://stackoverflow.com/questions/1422392/imagemagick-in-asp-net-via-command-line</a> where I stated that I would go with the caching solution, but the high CPU usage I noticed when working with larger amounts of data seems like it might be problematic.</p>
