ImageMagick - 在 Python 中使用 ICC 将图像 RGB 转换为 CMYK



有没有办法在python ImageMagick绑定中使用ICC将RGB图像转换为CMYK图像。我知道您可以在命令行中轻松完成此操作,但是无论如何都可以在像 Wand(最好是 Wand)这样的绑定中执行此操作?我现在拥有的是:

from wand.image import Image
from urllib.request import urlopen
response = urlopen('https://www.website.com/path/to/image.jpg')
try:
    with Image(file=response) as img:
        img.type = 'truecolor'
        img.alpha_channel = True
        img = img.colorspace = 'cmyk'
        img.save(filename='converted.jpg')
finally:
    response.close()

这导致图像具有非常不准确的颜色,但颜色空间正确。有没有办法使用配置文件进行转换?谢谢。

尝试使用 wand.image.Image.transform_colorspace

with Image(file=response) as img:
    img.transform_colorspace('cmyk')
    img.save(filename='converted.jpg')

最新更新