webpack为开发者处理图像(图像处理控件Aspose.Imaging)

Aspose.Imaging for .NET一种高级图像处理控件,允许开发人员创建,编辑,绘制或转换图像图像导出和转换是API核心功能之一,它允许在不安装Photoshop应用程序或任何其他图像编辑器的情况下保存为AdobePhotoshop®本机格式,现在小编就来说说关于webpack为开发者处理图像?下面内容希望能帮助到你,我们来一起看看吧!

webpack为开发者处理图像(图像处理控件Aspose.Imaging)

webpack为开发者处理图像

Aspose.Imaging for .NET一种高级图像处理控件,允许开发人员创建,编辑,绘制或转换图像。图像导出和转换是API核心功能之一,它允许在不安装Photoshop应用程序或任何其他图像编辑器的情况下保存为AdobePhotoshop®本机格式。

近期发布了Aspose.Imaging for .NET v19.6,JPEG输出中不再保留IMAGINGNET-3351 DPI属性,下面我们一起来探索新版中的新增功能及其工作原理。

▲JPEG输出中不保留IMAGINGNET-3351 DPI属性

string dir = "c:\\aspose.work\\IMAGINGNET\\3351\\"; using (Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)Image.Load(dir "source2.tif")) { int i = 0; foreach (Aspose.Imaging.FileFormats.Tiff.TiffFrame tiffFrame in tiffImage.Frames) { Aspose.Imaging.ImageOptions.JpegOptions saveOptions = new Aspose.Imaging.ImageOptions.JpegOptions(); saveOptions.ResolutionSettings = new ResolutionSetting(tiffFrame.HorizontalResolution, tiffFrame.VerticalResolution); if (tiffFrame.FrameOptions != null) { // Set the resolution unit explicitly. switch (tiffFrame.FrameOptions.ResolutionUnit) { case Aspose.Imaging.FileFormats.Tiff.Enums.TiffResolutionUnits.None: saveOptions.ResolutionUnit = ResolutionUnit.None; break; case Aspose.Imaging.FileFormats.Tiff.Enums.TiffResolutionUnits.Inch: saveOptions.ResolutionUnit = ResolutionUnit.Inch; break; case Aspose.Imaging.FileFormats.Tiff.Enums.TiffResolutionUnits.Centimeter: saveOptions.ResolutionUnit = ResolutionUnit.Cm; break; default: throw new System.NotSupportedException(); } } string fileName = "source2.tif.frame." (i ) "." saveOptions.ResolutionUnit ".jpg"; tiffFrame.Save(dir fileName, saveOptions); } }

▲IMAGINGNET-3321加载PNG图像时占用大量内存

using (Image image = Image.Load("halfGigImage.png")) { // todo something }

▲IMAGINGNET-3287将WMF转换为SVG时会添加边距

string dir = "c:\\aspose.work\\IMAGINGNET\\3287\\"; string fileName = dir "image2.wmf"; // Save WMF to SVG using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(fileName)) { // The customer uses EmfRasterizationOptions instead of WmfRasterizationOptions. // EmfRasterizationOptions works correctly in .NET as well. Aspose.Imaging.ImageOptions.WmfRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.WmfRasterizationOptions(); rasterizationOptions.Pagesize = image.Size; Aspose.Imaging.ImageOptions.SvgOptions saveOptions = new Aspose.Imaging.ImageOptions.SvgOptions(); saveOptions.VectorRasterizationOptions = rasterizationOptions; image.Save(fileName ".svg", saveOptions); } // Save WMF to PNG using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(fileName)) { // The customer uses EmfRasterizationOptions instead of WmfRasterizationOptions. // EmfRasterizationOptions works correctly in .NET as well. Aspose.Imaging.ImageOptions.WmfRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.WmfRasterizationOptions(); rasterizationOptions.PageSize = image.Size; Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions(); saveOptions.VectorRasterizationOptions = rasterizationOptions; image.Save(fileName ".png", saveOptions); }

▲IMAGINGNET-3378在将WMF转换为PNG时裁剪图像宽度和高度

public void WmfToJpg() { using (Image image = Image.Load("portrt.wmf")) { image.Save( "portrt.jpg", new JpegOptions() { VectorRasterizationOptions = new WmfRasterizationOptions { BackgroundColor = Color.WhiteSmoke, PageWidth = image.Width, PageHeight = image.Height, } }); } } public void WmfToPngWithBorders() { using (Image image = Image.Load("portrt.wmf")) { image.Save( "portrt.png", new PngOptions() { VectorRasterizationOptions = new WmfRasterizationOptions { BackgroundColor = Color.WhiteSmoke, PageWidth = image.Width, PageHeight = image.Height, BorderX = 50, BorderY = 20 } }); } }

▲IMAGINGNET-3336使用ODG文件格式时,将在控制台中打印文本

string fileName = "example.odg"; using (OdgImage image = (OdgImage)Image.Load(fileName)) { }

▲IMAGINGNET-3421 GIF文件未正确转换为PDF

public void TestExportGifToPdf() { string[] fileNames = new [] { "czone.gif", "DTRA_LogoType.gif", "DTRA_Seal.gif", "Equip1.gif", "Equip2.gif", "Equip3.gif" }; foreach (string fileName in fileNames) { using (Image image = Image.Load(fileName)) { image.Save(fileName ".pdf", new PdfOptions()); } } }

▲IMAGINGNET-3205 RotateFlip操作与PSD无法正常工作

// RotateFlip operation doesn't work as expected with PSD string sourceFile = "1.psd"; string pngPath = "RotateFlipTest2617.png"; string psdPath = "RotateFlipTest2617.psd"; RotateFlipType flipType = RotateFlipType.Rotate270FlipXY; using (var im = (PsdImage)(Image.Load(sourceFile))) { im.RotateFlip(flipType); im.Save(pngPath, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha }); im.Save(psdPath); }

▲IMAGINGNET-3374将DJVU格式转换为图像的问题

using (DjvuImage image = (DjvuImage)Imaging.Image.Load(@"input.djvu")) { PngOptions exportOptions = new PngOptions(); for (int i = 0; i < image.Pages.Length; i ) { DjvuPage page = image.Pages[i]; page.Save(@"page" i ".png", exportOptions); } }

▲IMAGINGNET-3339 SvgRasterizationOptions大小设置不起作用

using (Image image = Image.Load("test.svg")) { image.Save("test.svg_out.bmp", new BmpOptions() { VectorRasterizationOptions = new SvgRasterizationOptions() { PageWidth = 100, PageHeight = 200 } }); }

>>下载Aspose.Imaging for .NET v19.6体验点击下方“了解更多”

,

免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com

    分享
    投诉
    首页