Resize during image read in Magick.NET

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
Posts: 21
Joined: 2019-10-29T07:03:33-07:00
Authentication code: 1152

Resize during image read in Magick.NET

Post by VasyaIvonov2 »


I have read about 'Resize During Image Read':
The resize operator can also be applied to images immediately after being read, before it is added to the current image sequence and the next image is read. That way a minimal amount of memory is needed to read in a lot of images. Example:
convert dragon.gif'[64x64]' read_dragon.gif
I want use this feature in C# (with Magick.NET lib). But I can't find out how to do this. I tried to use next:

Code: Select all

            MagickReadSettings rs = new MagickReadSettings()
                Width = 100,
                Height = 100

            using (MagickImage image = new MagickImage("MyBigTifFile.tif", rs))
But 'MyBigTifFileThumb.tif' is the same size as source image. I can resize by calling image.Resize, but it will do after image read.

Posts: 12938
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Resize during image read in Magick.NET

Post by snibgo »

The example you show has the size appended to the filename, so try that:

Code: Select all

using (MagickImage image = new MagickImage("MyBigTifFile.tif[64x64]", rs))
snibgo's IM pages:

Post Reply