如何在Java中设置icc颜色配置文件并更改颜色空间

发布于 2024-07-11 08:51:19 字数 140 浏览 4 评论 0原文

首先,我想说我不是图像处理专家。

我想将图像色彩空间从一种转换为另一种,并同时更改 icc 颜色配置文件。 我设法使用 JMagick(ImageMagick Java 端口)来做到这一点,但在纯 Java 中却无法做到(甚至使用 JAI)。

First, I would like to say I'm not an image processing specialist.

I would like to convert image colorspace from one to another, and change icc color profile at the same time. I managed to do it using JMagick (the ImageMagick Java port), but no way in pure Java (even using JAI).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

这样的小城市 2024-07-18 08:51:19

使用 ColorConvertOp,这将进行色彩空间转换。 您有多个选项来设置 icc 颜色配置文件。 您可以通过使用 getInstance 和正确的色彩空间常量来使用预定义的配置文件,也可以指定一个包含配置文件的文件。 下面是一个示例:

ICC_Profile ip = ICC_Profile.getInstance( ColorSpace.CS_sRGB );
ICC_ColorSpace ics = new ICC_ColorSpace( ip );
ColorConvertOp cco = new ColorConvertOp( ics, null );
BufferedImage result = cco.filter( sourceImage, null );

结果将包含具有sRGB颜色空间的图像。

Use ColorConvertOp, this will do the color space conversion. You have several options to set a icc color profile. Either you use a predefined profile by using getInstance with the correct color space constant or you can specify a file, which contains a profile. Here is an example:

ICC_Profile ip = ICC_Profile.getInstance( ColorSpace.CS_sRGB );
ICC_ColorSpace ics = new ICC_ColorSpace( ip );
ColorConvertOp cco = new ColorConvertOp( ics, null );
BufferedImage result = cco.filter( sourceImage, null );

The result will contain an image with the sRGB color space.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文