原創|產品更新|編輯:李顯亮|2020-08-27 09:45:38.890|閱讀 250 次
概述:Aspose.Imaging for .NET更新至最新版v20.8,實現從TIFF圖像中的Path資源創建GraphicsPath的功能,增強EPS格式支持,支持加載和轉換EPS文件PDF / A格式,支持本機導出柵格-HTML5 Canvas等,歡迎下載體驗。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.Imaging for .NET是一種高級圖像處理控件,允許開發人員創建,編輯,繪制或轉換圖像。圖像導出和轉換是API核心功能之一,它允許在不安裝Photoshop應用程序或任何其他圖像編輯器的情況下保存為AdobePhotoshop®本機格式。
事實證明,Aspose.Imaging是處理各種圖像格式的強大API。除單頁圖像外,Aspose.Imaging還支持處理多頁圖像,包括GIF,TIFF,PSD,DICOM,CDR和WebP。
近期發布了Aspose.Imaging for .NET v20.8,實現從TIFF圖像中的Path資源創建GraphicsPath的功能,增強EPS格式支持,支持加載和轉換EPS文件PDF / A格式,支持本機導出柵格-HTML5 Canvas等,還沒使用過的朋友可以點擊下載最新版Aspose.Imaging
key | 概述 | 類別 |
---|---|---|
IMAGINGNET-3989 | 實現從TIFF圖像中的Path資源創建GraphicsPath的能力,反之亦然 | 功能 |
IMAGINGNET-3732 | 增強EPS格式支持 | 功能 |
IMAGINGNET-2243 | 支持加載和轉換EPS文件PDF / A格式 | 功能 |
IMAGINGNET-4045 | PSD導出器不支持壓縮方法 | 增強功能 |
IMAGINGNET-4033 | 調整PNG大小并保存為JPG后黑色輸出 | 增強功能 |
IMAGINGNET-4016 | 使用RLE壓縮導出到BMP時輸出不正確 | 增強功能 |
IMAGINGNET-4011 | WebPOptions.Quality屬性不影響導出期間WebP圖像壓縮的程度 | 增強功能 |
IMAGINGNET-3995 | 呈現WMF文件時引發“文件已損壞或損壞”異常 | 增強功能 |
IMAGINGNET-3994 | 支持本機導出柵格-HTML5 Canvas | 增強功能 |
IMAGINGNET-3985 | 根據Aspose.Psd調整大小實施其他調整大小方法 | 增強功能 |
IMAGINGNET-3982 | 通過TIFF的像素讀取打開LoadRawData中的異常 | 增強功能 |
IMAGINGNET-3981 | 逐行讀取TIFF的LoadRawData中的異常 | 增強功能 |
IMAGINGNET-3977 | 加載webp圖像時異常 | 增強功能 |
IMAGINGNET-3974 | 保存JP2時,對象引用未設置為對象異常的實例 | 增強功能 |
IMAGINGNET-3973 | 保存ODG時未定義的函數“ if”異常 | 增強功能 |
IMAGINGNET-3867 | 在VectorImageExporter中支持剪切操作 | 增強功能 |
IMAGINGNET-3843 | Aspose.Imaging 20.3:嘗試將特定的Emf轉換為光柵圖像時發生異常 | 增強功能 |
IMAGINGNET-3748 | WMF圖像在導出的PDF的右側被剪切 | 增強功能 |
IMAGINGNET-2981 | 轉換EPS的異常 | 增強功能 |
// When exporting to PSD, options for compression, color type and bitness are available: using (Image image = Image.Load(SRC)) { // Export to PSD with RLE compression image.Save(DEST1, new PsdOptions() { CompressionMethod = CompressionMethod.RLE }); // Export to PSD with RGB color type image.Save(DEST2, new PsdOptions() { ColorMode = ColorModes.Rgb, ChannelsCount = 3, ChannelBitsCount = 8 }); // Export to PSD with ARGB color type image.Save(DEST3, new PsdOptions() { ColorMode = ColorModes.Rgb, ChannelsCount = 4, ChannelBitsCount = 8 }); // Export to PSD with Grayscale color type image.Save(DEST4, new PsdOptions() { ColorMode = ColorModes.Grayscale, ChannelsCount = 1, ChannelBitsCount = 8 }); // Export to PSD with Monochrome color type image.Save(DEST5, new PsdOptions() { ColorMode = ColorModes.Bitmap, ChannelsCount = 1, ChannelBitsCount = 1 }); // Export to PSD with Indexed color type image.Save(DEST6, new PsdOptions() { ColorMode = ColorModes.Indexed, ChannelsCount = 1, ChannelBitsCount = 8, Palette = ColorPaletteHelper.Create8Bit() }); }
using (Image image = Image.Load("image01-100MB.png")) { image.Resize(600, 400); image.Save("output.jpg", new JpegOptions()); }
將柵格圖像導出為HTML5 Canvas格式,您可以輕松地將任何光柵圖像(動畫除外)導出為HTML5 Canvas圖像格式。以下代碼演示了如何導出為HTML5 Canvas格式:
using (var image = Image.Load("tiger.bmp")) { image.Save("tiger.html", new Html5CanvasOptions()); }
從TIFF圖像中的路徑資源創建圖形路徑。您可以在TIFF圖像中使用路徑資源來創建GraphicsPath類實例。GraphicsPath可以與Graphics類一起使用以在圖像上繪制。下一個源代碼示例顯示了如何創建GraphicsPath實例,然后在圖像上畫一條紅線?:
using (var image = (TiffImage)Image.Load("Bottle.tif")) { // Create the GraphicsPath using PathResources from TIFF image var graphicsPath = PathResourceConverter.ToGraphicsPath(image.ActiveFrame.PathResources.ToArray(), image.ActiveFrame.Size); var graphics = new Graphics(image); // Draw red line and save the image graphics.DrawPath(new Pen(Color.Red, 10), graphicsPath); image.Save("BottleWithRedBorder.tif"); } // Create Path Resources using Graphics Path? // Its also possible to create the Path Resources using Graphics Path. The next source code sample // demonstrates how you can accomplish that: static void Main(string[] args) { using (var image = (TiffImage)Image.Load("Bottle.tif")) { // Create rectangular Figure for GraphicsPath var figure = new Figure(); figure.AddShape(CreateBezierShape(100f, 100f, 500f, 100f, 500f, 1000f, 100f, 1000f)); // Create GraphicsPath using our Figure var graphicsPath = new GraphicsPath(); graphicsPath.AddFigure(figure); // Set PathResources using GraphicsPath var pathResouze = PathResourceConverter.FromGraphicsPath(graphicsPath, image.Size); image.ActiveFrame.PathResources = new List(pathResouze); // Save the image image.Save("BottleWithRectanglePath.tif"); } } private static BezierShape CreateBezierShape(params float[] coordinates) { var bezierPoints = CoordinatesToBezierPoints(coordinates).ToArray(); return new BezierShape(bezierPoints, true); } private static IEnumerableCoordinatesToBezierPoints(float[] coordinates) { for (var coordinateIndex = 0; coordinateIndex < coordinates.Length; coordinateIndex += 2) for (var index = 0; index < 3; index++) yield return new PointF(coordinates[coordinateIndex], coordinates[coordinateIndex + 1]); }
### What is EPS image format? EPS file format is short for Encapsulated PostScript. It was created by Adobe back in 1992. It's a standard graphics file format intended for placing images or drawings within a PostScript Document. Basically it's a postscript program saved as a single file. EPS file also includes a low-resolution preview of the graphics inside which makes it accessible with programs not capable of editing the script inside. EPS file format is widely used by publishers because of its compatibility across different operating systems. An EPS file can contain any combination of text, graphics, and images. Since it is actually a PostScript file, it is one of the most versatile file formats that are available. The files are supported by several different drawing programs and vector graphic editing applications. Many image converter programs can create EPS files containing the pixels of the image. An EPS file is a stream of generic PostScript printing commands. Thus many PostScript printer drivers have an option to save as EPS. ### The image preview EPS files can optionally contain a bitmapped image preview so that systems that can't render PostScript directly can at least display a crude representation of what the graphic will look like. There are 4 preview formats: PICT, TIFF, Metafile and EPSI. It is also possible to have an EPS file without a preview, though. In this case, the imported file is usually displayed as a grayed out box or a box with diagonal lines running through it. The preview image has a fixed resolution, which is usually 72 dpi. If you enlarge an EPS file in a document, the preview image is stretched and may become ‘blocky' and lacking in detail. This does not necessarily mean that the EPS-data themselves will degrade in quality. As long as the EPS-file only contains text and vector graphics, scaling it does not affect its quality. If you print a file containing an EPS-image on a non-PostScript printer, it is usually the preview image that gets printed. The preview image is ignored when you print to a PostScript device. ### Convert EPS image to PNG The following code converts EPS image to PNG. The property **PreviewToExport** allows to select the source of the image to export from EPS file. The value **PostScriptRendering** of the enumeration **EpsPreviewFormat** cause rendering from PostScript to raster image. using (var image = (EpsImage)Image.Load("Sample.eps")) { var options = new PngOptions { VectorRasterizationOptions = new EpsRasterizationOptions { PageWidth = 500, // Image width PageHeight = 500 // Image height } }; image.PreviewToExport = EpsPreviewFormat.PostScriptRendering; // Render raster image using the PostScript image.Save("Sample.png", options); } ### Convert EPS to other formats *Aspose.Imaging* library allows you to export EPS image to other formats. For that you just need to use corresponding Image options. The following code demonstrates how to export EPS image to PDF: using (var image = (EpsImage)Image.Load("Sample.eps")) { var options = new PdfOptions { PdfCoreOptions = new PdfCoreOptions { PdfCompliance = PdfComplianceVersion.PdfA1b // Set required PDF compliance } }; image.PreviewToExport = EpsPreviewFormat.PostScriptRendering; image.Save("Sample.pdf", options); } ### Determine whether the EPS image has a preview As we already discussed, EPS image can contain an encapsulated preview image. The following code shows how can you determine if the preview exists: using (var image = (EpsImage)Image.Load("Sample.eps")) { if (image.HasRasterPreview) { Console.WriteLine("The image has a raster preview."); } } ### Export EPS preview image without PostScript rendering There are several ways how can you export EPS preview image. The following code exports TIFF preview image: using (var image = (EpsBinaryImage)Image.Load("Sample.eps")) { // Tiff image export options var options = new TiffOptions(TiffExpectedFormat.TiffJpegRgb) // The first way: image.TiffPreview.Save("Sample1.tiff", options); // The second way: image.PreviewToExport = EpsPreviewFormat.TIFF; image.Save("Sample2.tiff", options); }
以下代碼演示了如何將EPS圖像導出為PDF:
using (var image = (EpsImage)Image.Load("Sample.eps")) { var options = new PdfOptions { PdfCoreOptions = new PdfCoreOptions { PdfCompliance = PdfComplianceVersion.PdfA1b // Set required PDF compliance } }; image.PreviewToExport = EpsPreviewFormat.PostScriptRendering; image.Save("Sample.pdf", options); }
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn