我假设您为 CMYK 显示的值以百分比 (100/0/0/0) 为单位。在 Imagemagick 命令行中,您可以执行以下操作来制作样本
convert xc:"cmyk(100%,0%,0%,7%)" -profile /Users/fred/images/profiles/ISOcoated_v2_300_eci.icc -profile /Users/fred/images/profiles/sRGB.icc -scale 100x100! test.png
或者你可以按如下方式取回值:
convert xc:"cmyk(100%,0%,0%,7%)" -profile /Users/fred/images/profiles/ISOcoated_v2_300_eci.icc -profile /Users/fred/images/profiles/sRGB.icc -format "%[pixel:u.p{0,0}]\n" info:
srgb(0%,61%,81%)
如果您想要 0 到 255 范围内的值而不是 %,则添加 -depth 8。
convert xc:"cmyk(100%,0%,0%,7%)" -profile /Users/fred/images/profiles/ISOcoated_v2_300_eci.icc -profile /Users/fred/images/profiles/sRGB.icc -depth 8 -format "%[pixel:u.p{0,0}]\n" info:
srgb(0,156,207)
您也可以从 0 到 255 之间的值开始。
convert xc:"cmyk(255,0,0,17.85)" -profile /Users/fred/images/profiles/ISOcoated_v2_300_eci.icc -profile /Users/fred/images/profiles/sRGB.icc -depth 8 -format "%[pixel:u.p{0,0}]\n" info:
srgb(0,156,207)
您可以通过 RMagick 做到这一点,但我不是 RMagick 专家。但请参阅sambecker 的另一篇文章。