原創|產品更新|編輯:李顯亮|2020-05-21 10:09:18.723|閱讀 256 次
概述:Aspose.Imaging for .NET更新至最新版v20.5,支持從TIFF提取路徑,優化Dicom格式的速度或內存,支持將可讀的全幀gif導出為多頁圖像格式,歡迎下載體驗。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.Imaging for .NET一種高級圖像處理控件,允許開發人員創建,編輯,繪制或轉換圖像。圖像導出和轉換是API核心功能之一,它允許在不安裝Photoshop應用程序或任何其他圖像編輯器的情況下保存為AdobePhotoshop®本機格式。
事實證明,Aspose.Imaging是處理各種圖像格式的強大API。除單頁圖像外,Aspose.Imaging還支持處理多頁圖像,包括GIF,TIFF,PSD,DICOM,CDR和WebP。
近期發布了Aspose.Imaging for .NET v20.5,支持從TIFF提取路徑,優化Dicom格式的速度或內存,支持將可讀的全幀gif導出為多頁圖像格式,還沒使用過的朋友可以點擊下載最新版Aspose.Imaging
key | 概述 | 類別 |
---|---|---|
IMAGINGNET-3731 | 支持從TIFF提取路徑 | 功能 |
IMAGINGNET-3417 | 允許Dicom格式的速度或內存優化策略 | 功能 |
IMAGINGNET-3724 | 支持將可讀的全幀gif導出為多頁圖像格式 | 功能 |
IMAGINGNET-3822 | 18.8-20.3:無法繪制半透明圖像 | 增強功能 |
IMAGINGNET-3821 | 成像WMF到PDF的轉換問題 | 增強功能 |
IMAGINGNET-3820 | 合并TIFF圖像的異常 | 增強功能 |
IMAGINGNET-3819 | 導出為PDF時出現ImageSave異常 | 增強功能 |
IMAGINGNET-3812 | 從Tiff屬性中刪除主題和評論 | 增強功能 |
IMAGINGNET-3764 | 從EMF轉換為PNG或SVG時,出現黑色的“邊框” | 增強功能 |
### Clipping Path Clipping path is the Photoshop technique to remove the background from an image. Photoshop allows you to select a part of an image using Clipping Path and save the path within a file. Clipping Paths allow you to hide the part of an image you don't want to appear. Anything inside the clipping path will be visible, but anything outside of it will be transparent. Other words Photoshop makes it possible to isolate certain parts of an image, without permanently changing the layer. This allows you to tweak the image at any point in the creative process. Clipping Paths are a traditional method of cutting out objects or people in Photoshop that allows you to create image files with transparent backgrounds. This approach works best with objects or people with "hard" edges around the object or person you want to cut out. ### Access Clipping Paths in TIFF image *PathResources* property allows you to access Clipping Paths in TIFF frame. The following code retrieves paths from TIFF image and displays their names in the console: using (var image = (TiffImage)Image.Load("Sample.tif")) { foreach (var path in image.ActiveFrame.PathResources) { Console.WriteLine(path.Name); } } ### Modify existing Clipping Paths You can easily modify already existing Clipping Paths. For instance, you can keep only one Clipping Path in the image: using (var image = (TiffImage)Image.Load("Sample.tif")) { var paths = image.ActiveFrame.PathResources; image.ActiveFrame.PathResources = paths.Take(1).ToList(); image.Save(); } ### Create Clipping Path manually You can manually create Clipping Path in TIFF image. In order to do that you need to create an instance of *PathResource* class. The following code demonstrates the way how you can create an empty path in TIFF image: var options = new TiffOptions(TiffExpectedFormat.Default); var frame = new TiffFrame(options, 800, 600); using (var image = new TiffImage(frame)) { image.ActiveFrame.PathResources = new List{ new PathResource { BlockId = 2000, Name = "My Clipping Path", Records = new List() } }; image.Save("ImageWithEmptyPath.tiff"); } ### Clipping Path content To create your own Clipping Paths you need to understand their content. Photoshop stores its paths as resources with IDs in the range 2000 through 2997. The name of the resource is the name given to the path when it was saved. If the file contains a resource with an ID of 2999, then this resource contains the name of the clipping path. Each path has a set of records to hold the data. **Record classes:** *LengthRecord* - contains the number of Bezier knot records. *BezierKnotRecord* - describes the knots of the path. *ClipboardRecord* - contains four fixed-point numbers for the bounding rectangle. More details you can find in [Adobe Photoshop File Formats Specification](//www.adobe.com/devnet-apps/photoshop/fileformatashtml/).
// Added support for full-frame export from gif format string baseDirectoryPath = @"D:\"; string fileName = "Animation.gif"; string inputFilePath = Path.Combine(baseDirectoryPath, fileName); string outputFilePath = inputFilePath + "_FullFrame.tif"; string outputFilePath1 = inputFilePath + "_NonFullFrame.tif"; using (Image image = Image.Load(inputFilePath)) { image.Save(outputFilePath, new TiffOptions(TiffExpectedFormat.TiffDeflateRgb) { MultiPageOptions = new MultiPageOptions(new IntRange(2, 5)), FullFrame = true }); image.Save(outputFilePath1, new TiffOptions(TiffExpectedFormat.TiffDeflateRgb) { MultiPageOptions = new MultiPageOptions(new IntRange(2, 5))}); }
// Example 1. Setting a memory limit of 50 megabytes for operations on the created Dicom image var imageOptions = new DicomOptions(); imageOptions.Source = new FileCreateSource("created.dcm", false); imageOptions.BufferSizeHint = 50; using (Image image = Image.Create(imageOptions, 1000, 1000)) { // Do something with the created image //... image.Save(); } // Example 2. Setting a memory limit of 20 megabytes for operations on the loaded Dicom image var loadOptions = new LoadOptions(); loadOptions.BufferSizeHint = 20; using (Image image = Image.Load("image.dcm", loadOptions)) { // Do something with the loaded image //... } // Example 3. Settings a memory limit of 30 mebagytes for export-to-dicom operation var loadOptions = new LoadOptions(); loadOptions.BufferSizeHint = 30; using (Image image = Image.Load("image.png", loadOptions)) { image.Save("exported.dcm", new DicomOptions()); }
// Create a multi-page Dicom image. using (DicomImage image = (DicomImage)Image.Create( new DicomOptions() { Source = new StreamSource(new MemoryStream()) }, 100, 100)) { // Draw something using vector graphics Graphics graphics = new Graphics(image); graphics.FillRectangle(new SolidBrush(Color.BlueViolet), image.Bounds); graphics.FillRectangle(new SolidBrush(Color.Aqua), 10, 20, 50, 20); graphics.FillEllipse(new SolidBrush(Color.Orange), 30, 50, 70, 30); // Save the pixels of the drawn image. They are now on the first page of the Dicom image. int[] pixels = image.LoadArgb32Pixels(image.Bounds); // Add a few pages after, making them darker for (int i = 1; i < 5; i++) { DicomPage page = image.AddPage(); page.SaveArgb32Pixels(page.Bounds, pixels); page.AdjustBrightness(i * 30); } // Add a few pages in front of the main page, making them brighter for (int i = 1; i < 5; i++) { DicomPage page = image.InsertPage(0); page.SaveArgb32Pixels(page.Bounds, pixels); page.AdjustBrightness(-i * 30); } // Save the created multi-page image to the output file image.Save("MultiPage.dcm"); }
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn