Aspose.Imaging for .NET导出图片为多种格式

作者:控件中国网   出处:控件中国网   2015-05-28 11:33:33   阅读:58

Aspose.Imaging提供了丰富的API用于转换图片为多种文件格式,可以让开发人员可以创建、编辑、画图、转换图像的图像处库,提供了一些开发平台原有功能基础之上的一些新特性。它独立于其他应用程序, Aspose.Imaging 允许你在不安装PhotoShop的情况下保存PSD格式等。

下面的事例介绍了如何加载一个GIF文件,并且转换为BMP, JPEG, PNG 和TIFF,其他格式之间在转换使用上也跟该事例差不多,具体代码如下:

[C#]
//Load an existing image (of type Gif) in an instance of the Image class
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(@"C:\sample.gif"))
{
    //Export to BMP file format using the default options
    image.Save(@"C:\output.bmp", new Aspose.Imaging.ImageOptions.BmpOptions());

    //Export to JPEG file format using the default options
    image.Save(@"C:\output.jpeg", new Aspose.Imaging.ImageOptions.JpegOptions());

    //Export to PNG file format using the default options
    image.Save(@"C:\output.png", new Aspose.Imaging.ImageOptions.PngOptions());

    //Export to TIFF file format using the default options
    image.Save(@"c:\output.tiff", new Aspose.Imaging.ImageOptions.TiffOptions());
}
 
[Visual Basic]
'Load an existing image (of type Gif) in an instance of the Image class
Using image As Aspose.Imaging.Image = Aspose.Imaging.Image.Load("C:\sample.gif")
 'Export to BMP file format using the default options
 image.Save("C:\output.bmp", New Aspose.Imaging.ImageOptions.BmpOptions())

 'Export to JPEG file format using the default options
 image.Save("C:\output.jpeg", New Aspose.Imaging.ImageOptions.JpegOptions())

 'Export to PNG file format using the default options
 image.Save("C:\output.png", New Aspose.Imaging.ImageOptions.PngOptions())

 'Export to TIFF file format using the default options
 image.Save("c:\output.tiff", New Aspose.Imaging.ImageOptions.TiffOptions())
End Using

Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat