This project has moved and is read-only. For the latest updates, please go here.

Generic Resize Settings

May 26, 2015 at 8:17 AM

I need a universal resize method that can handle any supported image type.

The resize will always be a down sizing.

I've already noticed that its important to set the the "Density" when loading the image. I've set this at 150

I will be saving JPG.

What else do I need to add to handle PNG transparency etc so that it appears as if it was printed on a white sheet of paper?
var settings = new MagickReadSettings {Density = new PointD(150)};

                using (var image = new MagickImage(_mediaFolder + "/" + upload.FileName, settings)) {
                    image.Resize(1024, 1024);
                    image.Format = MagickFormat.Jpg;
                    filePath = ....
May 26, 2015 at 11:53 AM
You can use the ColorAlpha method to remove transparency from your image and make it white. But the current version of Magick.NET has a bug in ColorAlpha so you will have to wait for the next release for this. I hope to publish it this weekend.