1 | initial version |
You can use the Resize
method present in the MagickImage
class to zoom an image in Magick.Net. This method resizes an image by allowing you to specify the new dimensions of the image.
Here's an example code that uses the Resize
method to zoom an image by 2 times:
using (var image = new MagickImage("input.jpg"))
{
int newWidth = image.Width * 2; // Double the width
int newHeight = image.Height * 2; // Double the height
image.Resize(newWidth, newHeight);
// Save the zoomed image
image.Write("output.jpg");
}
In this example, the MagickImage
object is created with the input image input.jpg
. The new dimensions of the image are calculated by doubling the width and height of the original image. The Resize
method is then called with the new dimensions, which zooms the image by 2 times. Finally, the zoomed image is saved as output.jpg
.