如何在Java中设置icc颜色配置文件并更改颜色空间 [英] How to set icc color profile in Java and change colorspace

查看:706
本文介绍了如何在Java中设置icc颜色配置文件并更改颜色空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

我想将图像颜色空间从一个转换为另一个,并改变icc颜色同时配置文件。我设法使用JMagick(ImageMagick Java端口),但在纯Java中没有办法(甚至使用JAI)。

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

推荐答案

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

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

结果将包含一张图片 sRGB 色彩空间。

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

这篇关于如何在Java中设置icc颜色配置文件并更改颜色空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆