Aspose.Imaging for Java
探索 Aspose.Imaging for Java,一个功能强大的图像处理库,支持多种格式和跨平台操作,提供高级绘图和编辑功能。
Aspose.Imaging for Java 是一个为您提供高级图像和照片处理工具的库。借助这个灵活的 API,您可以轻松创建、加载、转换和操作图像,而无需使用专门的图像编辑器。
Aspose.Imaging for Java 是一个可靠且功能强大的库,支持多种格式,包括 EPS、DjVu、DNG、WebP、DICOM 和 SVG。它是您处理各种图像处理任务的理想解决方案。
Aspose.Imaging for Java 具备跨平台兼容性,可在 Windows 和 Linux 操作系统上无缝运行。无论您使用哪种平台,都能体验稳定、高质量的图像处理功能。
使用 Aspose.Imaging for Java,将图像处理质量提升到全新水平。立即开始使用我们的 API,探索其灵活性、稳定性和性能。
创建、加载和编辑图像
将图像转换为多种格式
庄稼
调整大小
图像去歪斜
支持动画多帧图像
统一图像页面(框架)处理
使用图形绘制图像(图形路径和不同的几何形状)
删除背景
内存优化策略
控制字体的同时绘制文本
保存嵌入或导出字体的 SVG
更改背景
为图像添加水印
查看图片
压缩
合并
抖动
灰度
筛选
卡通化
二值化
调整
除了丰富的处理例程外,API 还提供了一系列高级算法,使其成为一站式图像转换解决方案。这些算法封装在专门的类中,易于使用,能够可靠地将图像导出为常规光栅格式以及 PSD、WMF、EMF、DjVu、DICOM、DNG 和 WebP 格式。
使用这个库,格式转换就像将文件扩展名更改为所需的格式一样简单。
import com.aspose.imaging.*; | |
import com.aspose.imaging.imageoptions.*; | |
import com.aspose.imaging.fileformats.tiff.enums.TiffExpectedFormat; | |
import com.aspose.imaging.fileformats.pdf.PdfDocumentInfo; | |
try (Image img = Image.load(dir + "template.jpg")) | |
{ | |
// save in different formats | |
img.save(dir + "output.webp", new WebPOptions()); | |
img.save(dir + "output.psd ", new PsdOptions()); | |
img.save(dir + "output.tiff", new TiffOptions(TiffExpectedFormat.Default)); | |
// Save image to Pdf | |
PdfOptions exportOptions = new PdfOptions(); | |
exportOptions.setPdfDocumentInfo(new PdfDocumentInfo()); | |
img.save(dir + "output.pdf", exportOptions); | |
} |
Aspose.Imaging for Java 除了核心功能外,还支持一系列高级绘图功能。开发人员可以通过操作像素信息或使用“图形”和“路径”等高级功能在图像表面进行绘图。
Java 图像库使您能够轻松绘制线条、曲线、矩形和其他几何形状,用纯色或渐变和纹理填充封闭形状,使用对字体进行精细控制的选项绘制文本,并通过加载现有图像数据来绘制图像。
Aspose.Imaging 提供加载、编辑、处理和保存照片的功能。使用库,您可以轻松编辑已加载的照片、应用滤镜,并使用图形和路径对其进行操作。使用 Aspose.Imaging,您可以轻松过滤照片。
import com.aspose.imaging.Image; | |
import com.aspose.imaging.imageoptions.JpegOptions; | |
// load file to be converted | |
try (Image img = Image.load("photo.dng")) | |
{ | |
//Apply grayscale filter to loaded image | |
img.grayscale(); | |
//Save image to Jpeg format | |
img.save(dir + "output.jpg", new JpegOptions()); | |
} |
Aspose.Imaging for Java 支持压缩矢量图像。这些矢量图像是使用 zip 文件压缩器压缩的 EMF、WMF 和 SVG 格式的矢量图像。压缩后的大小平均为原始图像的 30% 至 70%。这可以节省介质空间并减少文件在网络上的传输时间。
使用 Aspose.Imaging for Java,您可以轻松创建具有指定参数的图像,对其进行操作并保存。
import com.aspose.imaging.*; | |
import com.aspose.imaging.imageoptions.*; | |
// Image width and height | |
int width = 500; | |
int height = 300; | |
// Where created image to store | |
String path = "C:/createdImage.png"; | |
// Create options | |
PngOptions options = new PngOptions(); | |
options.setSource(new FileCreateSource(path, false)); | |
try (PngImage image = (PngImage)Image.create(options, width, height)) | |
{ | |
// Create and initialize an instance of Graphics class | |
Graphics graphic = new Graphics(image); | |
// and Clear Graphics surface | |
graphic.clear(Color.Green); | |
// Draw line on image | |
graphic.drawLine(new Pen(Color.getBlue()), 9, 9, 90, 90); | |
// Resize image | |
int newWidth = 400; | |
image.resizeWidthProportionally(newWidth, ResizeType.LanczosResample); | |
// Crop the image to specified area | |
Rectangle area = new Rectangle(10, 10, 200, 200); | |
image.crop(area); | |
image.save(); | |
} |