Aspose.Imaging for .NET

探索Aspose.Imaging for .NET,一个功能强大的图像处理库,支持多种格式和跨平台操作,提供高级图像编辑、转换及压缩功能。

使用 Aspose.Imaging for .NET 充分发挥图像处理的潜力

Aspose.Imaging for .NET 是一个用户友好的库,为您提供高级图像处理功能。借助这个功能强大的 API,您可以轻松创建、加载、操作、转换和压缩图像或照片,无需专用图像编辑器即可使用各种图像处理功能。

发现主要特点:


  • 图像转换:轻松调整大小、裁剪、翻转、旋转、二值化、灰度化、校正倾斜和调整图像。
  • 高级操作:应用过滤器、alpha 混合、魔术棒工具、去除水印、去除背景、抖动和遮罩来控制您的图像处理任务。
  • 高效的内存优化:享受内存优化策略,确保图像处理流畅高效。
  • 绘图和图形基元:利用绘图工具的强大功能并使用图形基元来增强您的项目。
  • 导出和转换:无缝导出和转换图像,包括统一的多页图像处理。


格式兼容性

Aspose.Imaging for .NET 不仅灵活稳定,而且功能多样。它支持最常用的图像格式,并进一步支持 DjVu、DICOM、WebP、EPS 和 DNG 等特殊格式。这种广泛的格式支持使其成为您处理各种图像处理任务的首选解决方案。

跨平台兼容性

Aspose.Imaging 是一个跨平台库,确保与 Windows 和 Linux 环境兼容。无论您使用的是 Windows 还是 Linux 系统,Aspose.Imaging 都能提供一致、高质量的图像处理功能。

使用 Aspose.Imaging for .NET 将您的图像处理项目提升到新的高度。立即体验我们 API 的灵活性、稳定性和强大功能。

高级图像处理 API 功能


创建、加载和编辑图像

将图像转换为多种格式

庄稼

调整大小

图像去歪斜

支持动画多帧图像

统一图像页面(框架)处理

使用图形绘制图像(图形路径和不同的几何形状)

删除背景

内存优化策略

控制字体的同时绘制文本

保存嵌入或导出字体的 SVG

更改背景

为图像添加水印

查看图片

压缩

合并

适配器

各种图像滤镜和效果

抖动

灰度

筛选

卡通化

二值化

调整

转换图像格式

除了丰富的处理例程外,API 还提供了一系列高级算法,使其成为一站式图像转换解决方案。这些算法封装在专门的类中,易于使用,能够可靠地将图像导出为常规光栅格式以及 PSD、WMF、EMF、DjVu、DICOM、DNG 和 WebP 格式。

使用这个库,格式转换就像将文件扩展名更改为所需的格式一样简单。

以不同的格式保存图像 - C#


using System;

using System.IO;

using Aspose.Imaging;

using Aspose.Imaging.FileFormats.Djvu;

using Aspose.Imaging.FileFormats.Tiff.Enums;

using Aspose.Imaging.ImageFilters.FilterOptions;

using Aspose.Imaging.ImageOptions;



string templatesFolder = @"c:\Users\USER\Downloads\templates\";

string dataDir = templatesFolder;

using (var img = Aspose.Imaging.Image.Load(dataDir + "template.jpg"))

{

// save in different formats



img.Save(dataDir + "output.webp", new Aspose.Imaging.ImageOptions.WebPOptions());



img.Save(dataDir + "output.psd ", new Aspose.Imaging.ImageOptions.PsdOptions());



img.Save(dataDir + "output.tiff", new Aspose.Imaging.ImageOptions.TiffOptions(TiffExpectedFormat.Default));



// Save image to Pdf



PdfOptions exportOptions = new PdfOptions();



exportOptions.PdfDocumentInfo = new Aspose.Imaging.FileFormats.Pdf.PdfDocumentInfo();



img.Save(dataDir + "output.pdf", exportOptions);



}



File.Delete(dataDir + "output.webp");

File.Delete(dataDir + "output.psd");

File.Delete(dataDir + "output.tiff");

File.Delete(dataDir + "output.pdf");
view rawsave-image-in-different-formats.cs hosted with ❤ by GitHub

动态绘制图像

Aspose.Imaging for .NET 除了核心功能外,还支持一组高级绘图功能。开发人员可以通过操作像素信息或使用“图形”和“路径”等高级功能在图像表面绘图。

.NET 图像库使您能够轻松绘制线条、曲线、矩形和其他几何形状,用纯色或渐变和纹理填充封闭形状,使用对字体进行精细控制的选项绘制文本,并通过加载现有图像数据来绘制图像。

编辑照片

Aspose.Imaging 提供加载、编辑、处理和保存照片的功能。使用库,您可以轻松编辑已加载的照片、应用滤镜,并使用图形和路径对其进行操作。使用 Aspose.Imaging,您可以轻松过滤照片。

加载、编辑、过滤和保存照片 - C#


using Aspose.Imaging;

using System.IO;



string templatesFolder = @"c:\Users\USER\Downloads\templates\";

string dataDir = templatesFolder;

using (var img = (RasterImage)Aspose.Imaging.Image.Load(dataDir + "template.tiff"))

{

img.Grayscale();



// save in jpg format

img.Save(dataDir + "output.jpg", new Aspose.Imaging.ImageOptions.JpegOptions());

}



File.Delete(dataDir + "output.jpg");
view rawload-edit-filter-save-photos.cs hosted with ❤ by GitHub

压缩图像

Aspose.Imaging for .NET 支持压缩矢量图像。这些矢量图像是使用 zip 文件压缩器压缩的 EMF、WMF 和 SVG 格式的矢量图像。压缩后的大小平均为原始图像的 30% 至 70%。这可以节省介质空间并减少文件在网络上的传输时间。

创建图像、操作并将其保存到磁盘

使用 Aspose.Imaging for .NET,您可以轻松创建具有指定参数的图像,对其进行操作并保存。

创建 png 图像,对其进行操作并保存 - C#


using Aspose.Imaging;

using Aspose.Imaging.FileFormats.Png;

using Aspose.Imaging.ImageOptions;

using Aspose.Imaging.Sources;

using System.IO;



string templatesFolder = @"c:\Users\USER\Downloads\templates\";

string dataDir = templatesFolder;



// Image width and height

int width = 500;

int height = 300;



// Where created image to store

string path = dataDir + @"result.png";



// Create options

PngOptions options = new PngOptions() { Source = new FileCreateSource(path, false) };



using (PngImage image = (PngImage)Image.Create(options, width, height))

{

// Create and initialize an instance of Graphics class

// and Clear Graphics surface

Graphics graphic = new Graphics(image);

graphic.Clear(Color.Green);



// Draw line on image

graphic.DrawLine(new Pen(Color.Blue), 9, 9, 90, 90);



// Resize image

int newWidth = 400;



image.ResizeWidthProportionally(newWidth, ResizeType.LanczosResample);



// Crop the image to specified area

Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(10, 10, 200, 200);



image.Crop(area);

image.Save();

}



File.Delete(path);
view rawcreate-png-image-manipulate-and-save.cs hosted with ❤ by GitHub


产品推荐

  • 账号登录
社交账号登录