原創(chuàng)|產(chǎn)品更新|編輯:李顯亮|2020-08-27 09:45:38.890|閱讀 250 次
概述:Aspose.Imaging for .NET更新至最新版v20.8,實(shí)現(xiàn)從TIFF圖像中的Path資源創(chuàng)建GraphicsPath的功能,增強(qiáng)EPS格式支持,支持加載和轉(zhuǎn)換EPS文件PDF / A格式,支持本機(jī)導(dǎo)出柵格-HTML5 Canvas等,歡迎下載體驗(yàn)。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門(mén)軟控件火熱銷(xiāo)售中 >>
Aspose.Imaging for .NET是一種高級(jí)圖像處理控件,允許開(kāi)發(fā)人員創(chuàng)建,編輯,繪制或轉(zhuǎn)換圖像。圖像導(dǎo)出和轉(zhuǎn)換是API核心功能之一,它允許在不安裝Photoshop應(yīng)用程序或任何其他圖像編輯器的情況下保存為AdobePhotoshop®本機(jī)格式。
事實(shí)證明,Aspose.Imaging是處理各種圖像格式的強(qiáng)大API。除單頁(yè)圖像外,Aspose.Imaging還支持處理多頁(yè)圖像,包括GIF,TIFF,PSD,DICOM,CDR和WebP。
近期發(fā)布了Aspose.Imaging for .NET v20.8,實(shí)現(xiàn)從TIFF圖像中的Path資源創(chuàng)建GraphicsPath的功能,增強(qiáng)EPS格式支持,支持加載和轉(zhuǎn)換EPS文件PDF / A格式,支持本機(jī)導(dǎo)出柵格-HTML5 Canvas等,還沒(méi)使用過(guò)的朋友可以點(diǎn)擊下載最新版Aspose.Imaging
key | 概述 | 類(lèi)別 |
---|---|---|
IMAGINGNET-3989 | 實(shí)現(xiàn)從TIFF圖像中的Path資源創(chuàng)建GraphicsPath的能力,反之亦然 | 功能 |
IMAGINGNET-3732 | 增強(qiáng)EPS格式支持 | 功能 |
IMAGINGNET-2243 | 支持加載和轉(zhuǎn)換EPS文件PDF / A格式 | 功能 |
IMAGINGNET-4045 | PSD導(dǎo)出器不支持壓縮方法 | 增強(qiáng)功能 |
IMAGINGNET-4033 | 調(diào)整PNG大小并保存為JPG后黑色輸出 | 增強(qiáng)功能 |
IMAGINGNET-4016 | 使用RLE壓縮導(dǎo)出到BMP時(shí)輸出不正確 | 增強(qiáng)功能 |
IMAGINGNET-4011 | WebPOptions.Quality屬性不影響導(dǎo)出期間WebP圖像壓縮的程度 | 增強(qiáng)功能 |
IMAGINGNET-3995 | 呈現(xiàn)WMF文件時(shí)引發(fā)“文件已損壞或損壞”異常 | 增強(qiáng)功能 |
IMAGINGNET-3994 | 支持本機(jī)導(dǎo)出柵格-HTML5 Canvas | 增強(qiáng)功能 |
IMAGINGNET-3985 | 根據(jù)Aspose.Psd調(diào)整大小實(shí)施其他調(diào)整大小方法 | 增強(qiáng)功能 |
IMAGINGNET-3982 | 通過(guò)TIFF的像素讀取打開(kāi)LoadRawData中的異常 | 增強(qiáng)功能 |
IMAGINGNET-3981 | 逐行讀取TIFF的LoadRawData中的異常 | 增強(qiáng)功能 |
IMAGINGNET-3977 | 加載webp圖像時(shí)異常 | 增強(qiáng)功能 |
IMAGINGNET-3974 | 保存JP2時(shí),對(duì)象引用未設(shè)置為對(duì)象異常的實(shí)例 | 增強(qiáng)功能 |
IMAGINGNET-3973 | 保存ODG時(shí)未定義的函數(shù)“ if”異常 | 增強(qiáng)功能 |
IMAGINGNET-3867 | 在VectorImageExporter中支持剪切操作 | 增強(qiáng)功能 |
IMAGINGNET-3843 | Aspose.Imaging 20.3:嘗試將特定的Emf轉(zhuǎn)換為光柵圖像時(shí)發(fā)生異常 | 增強(qiáng)功能 |
IMAGINGNET-3748 | WMF圖像在導(dǎo)出的PDF的右側(cè)被剪切 | 增強(qiáng)功能 |
IMAGINGNET-2981 | 轉(zhuǎn)換EPS的異常 | 增強(qiáng)功能 |
// 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()); }
將柵格圖像導(dǎo)出為HTML5 Canvas格式,您可以輕松地將任何光柵圖像(動(dòng)畫(huà)除外)導(dǎo)出為HTML5 Canvas圖像格式。以下代碼演示了如何導(dǎo)出為HTML5 Canvas格式:
using (var image = Image.Load("tiger.bmp")) { image.Save("tiger.html", new Html5CanvasOptions()); }
從TIFF圖像中的路徑資源創(chuàng)建圖形路徑。您可以在TIFF圖像中使用路徑資源來(lái)創(chuàng)建GraphicsPath類(lèi)實(shí)例。GraphicsPath可以與Graphics類(lèi)一起使用以在圖像上繪制。下一個(gè)源代碼示例顯示了如何創(chuàng)建GraphicsPath實(shí)例,然后在圖像上畫(huà)一條紅線(xiàn)?:
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圖像導(dǎo)出為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); }
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn