原创|产品更新|编辑:龚雪|2016-07-04 11:51:51.000|阅读 366 次
概述:可将Photoshop功能嵌入您应用程序的强大控件Aspose.Imaging年中大更新,全面优化了对PSD、CAD、SVG和EMF等格式文件的支持!
# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>
核心 | 概述 | 类别 |
---|---|---|
IMAGINGNET-1605 | 支持为CAD和Emf格式设置字体 | 新特性 |
IMAGINGNET-1602 | 为emf文件进行裁剪 | 新特性 |
IMAGINGNET-1568 | 实现了对可缩放矢量图形(SVG)1.1格式的支持 | 新特性 |
IMAGINGNET-1523 | 能够将图像添加或输出为PSD图层 | 新特性 |
IMAGINGNET-1628 | 实现了Dicom载入程序 | 优化 |
IMAGINGNET-1595 | Aspose.Imaging可以将水平或垂直分辨率值进行舍入运算 | 优化 |
IMAGINGNET-1507 | Aspose.Imaging图像引擎的逐步引入 | 优化 |
EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions(); emfRasterizationOptions.BackgroundColor = Color.WhiteSmoke; PngOptions pngOptions = new PngOptions(); pngOptions.VectorRasterizationOptions = emfRasterizationOptions; string filePath = @"alphabet.emf"; using (EmfImage image = (EmfImage)Image.Load(filePath)) { Assert.IsTrue(image.Header.EmfHeader.Valid); image.CacheData(); pngOptions.VectorRasterizationOptions.PageWidth = 300; pngOptions.VectorRasterizationOptions.PageHeight = 350; FontSettings.Reset(); image.Save(filePath + "_default_fonts.png", pngOptions); string fontPath = @".\Fonts"; Listfonts = new List(FontSettings.GetDefaultFontsFolders()); fonts.Add(fontPath); FontSettings.SetFontsFolders(fonts.ToArray(), true); image.Save(filePath + "_with_my_fonts.png", pngOptions); }
EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions(); emfRasterizationOptions.BackgroundColor = Color.WhiteSmoke; PdfOptions pdfOptions = new PdfOptions(); pdfOptions.VectorRasterizationOptions = emfRasterizationOptions; string filePath = @"TestEmfBezier.emf"; string outPath = filePath + ".pdf"; using (EmfImage image = (EmfImage)Image.Load(filePath)) using (FileStream outputStream = new FileStream(outPath, FileMode.Create)) { Assert.IsTrue(image.Header.EmfHeader.Valid); image.Crop(30, 40, 50, 60); pdfOptions.VectorRasterizationOptions.PageWidth = image.Width; pdfOptions.VectorRasterizationOptions.PageHeight = image.Height; image.Save(outputStream, pdfOptions); }
EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions(); emfRasterizationOptions.BackgroundColor = Color.WhiteSmoke; PdfOptions pdfOptions = new PdfOptions(); pdfOptions.VectorRasterizationOptions = emfRasterizationOptions; string filePath = @"TestEmfExtPen.emf"; string outPath = filePath + ".pdf"; using (EmfImage image = (EmfImage)Image.Load(filePath)) using (FileStream outputStream = new FileStream(outPath, FileMode.Create)) { Assert.IsTrue(image.Header.EmfHeader.Valid); image.Crop(new Rectangle(30, 50, 100, 150)); pdfOptions.VectorRasterizationOptions.PageWidth = image.Width; pdfOptions.VectorRasterizationOptions.PageHeight = image.Height; image.Save(outputStream, pdfOptions); }
string sourceFileName = "source.psd"; string outputFileName = "result.psd"; using (PsdImage image = (PsdImage)Image.Load(sourceFileName)) { Layer layer = image.Layers[1]; layer = image.Layers[1]; string normalImagePath = "png_normal.png"; using (RasterImage drawImage = (RasterImage)Image.Load(normalImagePath)) { layer.DrawImage(new Point(10, 10), drawImage); } image.Save(outputFileName, new PsdOptions()); }
string inputFile = "1dicomEtalon.dicom"; using (DicomImage image = (DicomImage)Image.Load(inputFile)) { image.AdjustBrightness(50); image.Save("1dicomEtalon.png",new PngOptions()); }
using (Image img = Image.Load("Sildar_Hallwinter_150.png")) { RasterImage rasterImg = (RasterImage)img; Console.WriteLine(string.Format("Horizontal resoltuion = {0}", rasterImg.HorizontalResolution)); Console.WriteLine(string.Format("Vertical resoltuion = {0}", rasterImg.VerticalResolution)); }
public void DoSomeDrawing(Aspose.Imaging.Image image) { Aspose.Imaging.Graphics.UseOwnDrawingEngine = true; Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image); // Do some drawing with 'graphics' here... }
public void DoSomeDrawing(Aspose.Imaging.Image image) { Aspose.Imaging.Graphics.UseOwnDrawingEngine = false; Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image); // Draw with old drawing engine }
public void SvgImageExportExample() { string sourceFilesDirectory = @"Path_to_source_folder\Source"; string destFolderPath = @"Path_to_results_folder\Results"; string[] srcFilePaths = Directory.GetFiles(sourceFilesDirectory); BmpOptions bmpOptions = new BmpOptions() { BitsPerPixel = 32 }; JpegOptions jpegOptions = new JpegOptions(); PngOptions pngOptions = new PngOptions(); PsdOptions psdOptions = new PsdOptions() { CompressionMethod = Imaging.FileFormats.Psd.CompressionMethod.RLE }; TiffOptions tiffOptions = new TiffOptions(TiffExpectedFormat.Default) { Compression = Aspose.Imaging.FileFormats.Tiff.Enums.TiffCompressions.None, BitsPerSample = new ushort[] { 8, 8, 8 }, PlanarConfiguration = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPlanarConfigs.Contiguous, Photometric = Aspose.Imaging.FileFormats.Tiff.Enums.TiffPhotometrics.Rgb }; ImageOptionsBase[] saveOptions = { bmpOptions, jpegOptions, pngOptions, tiffOptions, psdOptions }; foreach (string srcFilePath in srcFilePaths) { using (SvgImage image = (SvgImage)Image.Load(srcFilePath)) { foreach (ImageOptionsBase options in saveOptions) { string destFileName = this.GetOutputFileName(srcFilePath, options); string destFilePath = Path.Combine(destFolderPath, destFileName); image.Save(destFilePath, options); } } } } private string GetOutputFileName(string srcFilePath, ImageOptionsBase options) { string extension; if (options is BmpOptions) { extension = "bmp"; } else if (options is JpegOptions) { extension = "jpg"; } else if (options is TiffOptions) { extension = "tif"; } else if (options is PngOptions) { extension = "png"; } else if (options is PsdOptions) { extension = "psd"; } else { throw new Exception("Invalid image options"); } return string.Format("{0}.{1}", Path.GetFileNameWithoutExtension(srcFilePath), extension); }
核心 | 概述 | 类别 |
---|---|---|
IMAGING-35315 | 转换成JPG图像时,支持合并PSD图层 | 特色 |
IMAGING-35301 | 支持将Emf/Emf+文件输出为光栅模式 | 特色 |
IMAGING-35078 | 在.NET中支持图元文件(EMF) | 特色 |
IMAGING-35317 | 将PSD转换为TIFF时出现错误 | 优化 |
IMAGING-35302 | 渲染emf/emf+时提升内存使用 | 优化 |
IMAGING-35198 | Aspose.Imaging图像引擎逐步引入,使我们自己的图像引擎可以使用 | 优化 |
IMAGING-34796 | 验证所有光栅图像的操作,这样水印就不会重复了 | 优化 |
public void Run() { String filePath = "TestEmfBezier.emf"; EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions(); emfRasterizationOptions.setBackgroundColor(Color.getPapayaWhip()); emfRasterizationOptions.setPageWidth(300); emfRasterizationOptions.setPageHeight(300); ExportImage(filePath,new BmpOptions(),emfRasterizationOptions); ExportImage(filePath,new GifOptions(),emfRasterizationOptions); ExportImage(filePath,new JpegOptions(),emfRasterizationOptions); ExportImage(filePath,new Jpeg2000Options(),emfRasterizationOptions); ExportImage(filePath,new PngOptions(),emfRasterizationOptions); ExportImage(filePath,new PsdOptions(),emfRasterizationOptions); TiffOptions tiffOptions= new TiffOptions(TiffExpectedFormat.TiffLzwRgb); tiffOptions.setVectorRasterizationOptions(emfRasterizationOptions); ExportImage(filePath,tiffOptions,emfRasterizationOptions); ExportImage(filePath,new WebPOptions(),emfRasterizationOptions); } private void ExportImage(String srcFileName,ImageOptionsBase toOptions,EmfRasterizationOptions emfRasterizationOptions) { EmfImage image = EmfImage.load(srcFileName); try { if (!image.getHeader().getEmfHeader().getValid()) { throw new ImageLoadException("The file " + srcFileName +" is not valid"); } toOptions.setVectorRasterizationOptions(emfRasterizationOptions); String ext = toOptions.getClass().getName().replace("Options", ""); image.save(srcFileName + "."+ext, toOptions); } finally { image.dispose(); } }
string filePath = "TestEmfBezier.emf"; EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions(); emfRasterizationOptions.BackgroundColor = Color.PapayaWhip; emfRasterizationOptions.PageWidth = 300; emfRasterizationOptions.PageHeight = 300; using (var image = (EmfImage)Image.Load(filePath)) { if (!image.Header.EmfHeader.Valid) { throw new ImageLoadException(string.Format("The file {0} is not valid", filePath)); } image.Save(filePath + ".png", new PngOptions() { VectorRasterizationOptions = emfRasterizationOptions }); }
string outputPath = "result.jpg"; using (RasterImage image = (RasterImage)Image.Load("im-resolution-150.jpg")) { image.AdjustBrightness(200); image.RotateFlip(RotateFlipType.Rotate180FlipX); image.Save(outputPath); }
string outputPath = "result.jpg"; using (RasterImage image = (RasterImage)Image.Load("im-resolution-150.jpg")) { image.AdjustGamma(5); image.RotateFlip(RotateFlipType.Rotate180FlipX); image.Save(outputPath); }
public void DoSomeDrawing(Aspose.Imaging.Image image) { Aspose.Imaging.Graphics.UseOwnDrawingEngine = true; Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image); // Do some drawing with 'graphics' here... }
public void DoSomeDrawing(Aspose.Imaging.Image image) { Aspose.Imaging.Graphics.UseOwnDrawingEngine = false; Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image); // Draw with old drawing engine }
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn
文章转载自:慧都控件网