Home

Awesome

get via nuget Omu.Drawing2

download dll here

add using:

using Omu.Drawing;

cropping

Image img = Imager.Crop(sourceImage, new Rectangle(x, y, width, height));

resizing

resize an image and maintain aspect ratio

Image img = Imager.Resize(sourceImage, newWidth, maxHeight, onlyResizeIfWider);

save

Imager.Save(path, img, Imager.GetEncoderInfo("image/gif"));
// image/gif is the MIME type for gif`

save as jpeg

Imager.SaveJpeg(path, img);

put on canvas

the image remains the same size, and it is placed in the middle of the new canvas

Imager.PutOnWhiteCanvas(img, width, height))
// or
Imager.PutOnCanvas(img, width, height, Color.White))