I need the fastest library to resize full size images (some up to 9MB in size) to multiple sizes.
Here's the scenerio:
I'm not fussed if the library is C/C++ or anything else for that matter, as long as I can tap into it via .NET it's cool.
Also this will need to scale to possibly 1,000 active users.
Let me know your thoughts :)
Here is winforms way
public Image ResizeImage( Image img, int width, int height )
{
Bitmap b = new Bitmap( width, height ) ;
using(Graphics g = Graphics.FromImage( (Image ) b ))
{
g.DrawImage( img, 0, 0, width, height ) ;
}
return (Image ) b ;
}
and here is WPF way TransformedBitmap Class
I recommend ImageResizer:
Key features are:
For installing with Nuget:
PM> Install-Package ImageResizer.MvcWebConfig
PM> Install-Package ImageResizer.Plugins.DiskCache
PM> Install-Package ImageResizer.Plugins.PrettyGifs
For more information please check: http://imageresizing.net/docs/install/nuget
There are a lot of articles out there showing the basics of this. I've used the components from Atalasoft and found them to be of pretty good quality. There are nuances to resizing and working with JPEG images.
You seem to be really concerned with performance but you don't really give enough information to help us suggest good optimizations for you. Whatever you are doing, you need to do a full performance analysis and understand what is running slow. In some cases slowish, but maintainable image processing code may be OK if other things are optimized.
One solution for good performance is to queue incoming files that need to be converted. Add more machines to handle more messages in the queue, or optimize the service code to get better throughput. It's really not that difficult to handle a large number of users if you get the design right.
If money is no object, LeadTools is the traditional "go to" library for image processing. That being said, my first inclination would be to code it up using stock .NET GDI+ calls and then do some testing. It is likely this solution would be performant enough, but if not, you'll have a baseline from which you can compare other libraries and solutions. Anything involving spawning a command line tool will entail creating a separate process for each image, which could negate the benefit of going to unmanaged code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With