c# - Reuse imagemagick process instance in asp.net app -


Well, making thumbnail images in the asp.net app makes me more painful.

I had used the system before. Dragging stuff but then I'm not satisfied with the amount of code to write for a few simple resizing on a fixed canvas, then I've read about the warning of controversial discussion by Microsoft. System Asp.net did not work in web context and ultimately performance of bitmap operations was bad.

That's why I switched to Imagemagick (IM) to generate thumbnails. It actually works very well because I have experience working with IM in IP and creating a new system it happens. Diagnostics The process is a simple operation.

However, when I need to generate several thumbs in a request (30 or more), the CPU goes through the roof (100%) and until the last thumb is drawn Lives there. Of course the images are cached after being written once, but still - it worries me because there are other applications on the server, which should always be hung to remain without any pending thumb.

If you are not familiar with Image Magic, here's an example of how I use it:

  /path/to/im/convert.exe large Jpg ... some options ... small.png  

So I convert new to each image. Exe Example (through the new system. Diagnostics process), and what is it that puts too much CPU load on the server. Is there a better way to do this? Switching from ImageMagick to another image creation solution is not an option. PS: Yes, this is a follow-up to my previous question, where I said that I go with the caching solution, but the high CPU usage I noticed that working with large amounts of data seems like this Is that it can be problematic.

Unless you know all the images that change before the first conversion begins,

  convert.exe (first_image.jpg ... some options ... -write first_image_small.png + delete) can use something like (.. second image ...) last_image ... Options ... last_image_small.png  

In this way you will not need to create a new process for each image, which you want to change.

If you are worried about an image conversion, you may want to change the priority class of the ImageMagic process while taking too much CPU time so that only the user needs to convert the pictures The request can be influenced by the conversion.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -