【发布时间】:2019-07-23 10:15:26
【问题描述】:
我正在尝试使用wand-py在pyhon中实现以下imagemagick命令
我原来的转换命令是
convert ./img_1.png ( -clone 0 -colorspace SRGB -resize 1x1! -resize 569x380\! -modulate 100,100,0 ) ( -clone 0 -fill gray(50%) -colorize 100 ) -compose colorize -composite -colorspace sRGB -auto-level media/color-cast-1-out-1.jpeg
我正在尝试使用wand-py 创建两个克隆,如下所示,是正确的还是应该只做一个克隆?
with Image(filename='media/img1.jpeg') as original:
size = original.size
with original.convert('png') as converted:
# creating temp miff file
# 1st clone
with converted.clone() as firstClone:
firstClone.resize(1, 1)
firstClone.transform_colorspace('srgb')
firstClone.modulate(100, 100, 0)
firstClone.resize(size[0], size[1])
firstClone.format = 'jpeg'
firstClone.save(filename='media/img-1-clone-1.jpeg')
# 2nd clone
with converted.clone() as secondClone:
with Drawing() as draw:
draw.fill_color = 'gray'
draw.fill_opacity = 0.5
draw.draw(secondClone)
secondClone.format = 'jpeg'
secondClone.save(filename='media/img-1-clone-2.jpeg')
任何关于将上述命令转换为wand-py python 命令的帮助。
谢谢。
【问题讨论】:
标签: python imagemagick wand