We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Image Optimizer

Hi
I want to be able to resize and optimize an image
for web, ebooks etc.

Do you have a component for this?

if yes, can you provide some sample code on how to
use it to resize and optimize images (JPG, GIFS, PNG etc)


Hi Nitin,

Thank you for considering Aspose products.

Aspose.Imaging provides means to re-size images of type Gif, Tiff, Png and Jpeg. Please check the below provided code snippet for your reference.

C#


using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(“DSC01768.jpg”))
{
int width = image.Width - 200;
int height = image.Height - 200;

image.Resize(width, height, ResizeType.CenterToCenter);
image.Save(“DSC01768_resize.jpg”);
}

Aspose.Imaging API also offers an overloaded version of Image.Resize method that does not accept the third parameter (ResizeType).

Please feel free to write back in case you need our further assistance.

Hi Nitin,


It is to bring in your knowledge that with the release of Aspose.Imaging for .NET 2.6.0, the API has exposed the ResizeWidthProportionally and ResizeHeightProportionally methods for the Image class. These methods can be used to re-size existing images on the fly while keeping the aspect ratio. Please check the detailed article on Resize Images Proportionally, and feel free to contact us in case you face any difficulty.

That's great!

Thank you so much, I will check this out!