OdgImage.Resize
Contents
[
Hide
]Resize(int, int, ImageResizeSettings)
This method helps developers to resize images programmatically. By invoking this function, you can dynamically adjust the dimensions of images, catering to specific requirements or constraints within their applications.
public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)
Parameter | Type | Description |
---|---|---|
newWidth | Int32 | The new width. |
newHeight | Int32 | The new height. |
settings | ImageResizeSettings | The resize settings. |
See Also
- class ImageResizeSettings
- class OdgImage
- namespace Aspose.Imaging.FileFormats.OpenDocument
- assembly Aspose.Imaging
Resize(int, int, ResizeType)
This method facilitates image resizing with precise control over width, height, and resize type parameters. You can specify the desired dimensions and choose from different resizing algorithms or types to achieve optimal results based on application’s requirements.
public override void Resize(int newWidth, int newHeight, ResizeType resizeType)
Parameter | Type | Description |
---|---|---|
newWidth | Int32 | The new width. |
newHeight | Int32 | The new height. |
resizeType | ResizeType | The resize type. |
Examples
This example loads a multi-page ODG image and resizes it using various resizing methods.
[C#]
string dir = "c:\\temp\\";
using (Aspose.Imaging.FileFormats.OpenDocument.OdgImage image = (Aspose.Imaging.FileFormats.OpenDocument.OdImage)Aspose.Imaging.Image.Load(dir + "sample.odg"))
{
// Scale up by 2 times using Nearest Neighbour resampling.
image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with default options.
image.Save(dir + "upsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.OpenDocument.OdgImage image = (Aspose.Imaging.FileFormats.OpenDocument.OdImage)Aspose.Imaging.Image.Load(dir + "sample.odg"))
{
// Scale down by 2 times using Nearest Neighbour resampling.
image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
// Save to PNG with default options.
image.Save(dir + "downsample.nearestneighbour.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.OpenDocument.OdgImage image = (Aspose.Imaging.FileFormats.OpenDocument.OdImage)Aspose.Imaging.Image.Load(dir + "sample.odg"))
{
// Scale up by 2 times using Bilinear resampling.
image.Resize(image.Width* 2, image.Height* 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with default options.
image.Save(dir + "upsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
using (Aspose.Imaging.FileFormats.OpenDocument.OdgImage image = (Aspose.Imaging.FileFormats.OpenDocument.OdImage)Aspose.Imaging.Image.Load(dir + "sample.odg"))
{
// Scale down by 2 times using Bilinear resampling.
image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.BilinearResample);
// Save to PNG with default options.
image.Save(dir + "downsample.bilinear.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
See Also
- enum ResizeType
- class OdgImage
- namespace Aspose.Imaging.FileFormats.OpenDocument
- assembly Aspose.Imaging