彩票走势图

图像处理控件Aspose.Imaging v20.5 三大新功能上线!支持从TIFF提取路径

原创|产品更新|编辑:李显亮|2020-05-21 10:09:18.723|阅读 215 次

概述: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时,出现黑色的“边框” 增强功能

新功能用法示例

IMAGINGNET-3731支持从TIFF提取路径

### 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/).

IMAGINGNET-3724支持将可读的全帧gif导出为多页图像格式

 // 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))});
    }

IMAGINGNET-3417允许Dicom格式的速度或内存优化策略

 // 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"); }

Aspose是目前国内外非常火爆且功能强大的文件格式敏捷开发控件,但因为产品众多、技术问题复杂等因素,也常常遭受开发人员吐槽。如果您也正在使用Aspose相关产品,点击下方按钮,来谈谈Aspose的优劣,您的感受对我们相当宝贵哦~


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@cahobeh.cn


为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP