简体   繁体   English

如何将 DeviceGray 颜色转换为 rgb?

[英]How to convert DeviceGray color to rgb?

I read pdf structure using itext 7.0.4 library and when I read stream I found DeviceGray color in following form:我使用itext 7.0.4库读取 pdf 结构,当我读取stream我发现DeviceGray color为以下形式:

1 g

and how can I convert it to RGB format?以及如何将其转换为RGB格式?

float[] hsv = color.getColorValue();
int rgb = Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]);
Color target = new Color(rgb);

where color is instance of com.itextpdf.kernel.color.DeviceGray其中colorcom.itextpdf.kernel.color.DeviceGray实例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM