How to Create Thumbnail with ImageMagick in .net

For web and desktop application it is often required to auto generate thumbnails of single image or multiple image.

It is possible to write a code to scale/resize image, but with few lines of code you can use ImageMagick library to make this happen.

Create Visual Studio 2017/2019 project, get ImageMagick nuget pakcage.

ImageMagick has a feature method called Thumbnail that takes wide and height of thumbnail. It has other overloads as well.

Now let see how it works in code:

var file = new FileInfo(@"c:\temp\input.jpg");

using (MagickImage image = new MagickImage(file))
        image.Thumbnail(new MagickGeometry(100, 100));

I have made a cloud image for demonstration purpose and the thumbnail creation of it.

Create thumbnail from HiRes image.

Leave a Comment