( # 2 - ) http://www.codeproject.com/Articles/2941/Resizing-a-Photographic-image-with-GDI-for-NET , , ( ) .net System.Drawing.
ImageMagick:
convert input.png -resize 150x150 -background white -compose Copy -gravity center -extent 150x150 -quality 92 output3.png
but I found that ImageMagickNet, the ImageMagick shell for .Net, is not updated and there is no documentation for some commands; I will learn how to resize and resize an image, but I cannot find how to set the background color, gravity and other configurations. There is a discussion on the CodePlex page, but very few answers (http://imagemagick.codeplex.com/)
ImageMagickNET.MagickNet.InitializeMagick();
ImageMagickNET.Image img = new ImageMagickNET.Image("c:\\images\\input.png");
ImageMagickNET.Geometry geometry = new ImageMagickNET.Geometry("150x150");
img.Resize(geometry);
img.Compose(CompositeOperator.CopyCompositeOp);
img.Extent(geometry);
img.Write("c:\\images\output.png");
There are some tricks to make ImageMagickNET run, but you can easily find them on codeplex or stackoverflow. Therefore, my advice: go to System.Drawing!
source
share