[英]image composite result incorrect using python wand
I have 3 images need to composite together, but the result dose not same as original result from AfterEffect compositing. 我需要将3张图像合成在一起,但是结果剂量与AfterEffect合成的原始结果不同。 In AfterEffect , i need to use 32 bit image depth to do some composite , i have try the ImageMagick, the result is correct, i can do it in batch command but i have large layer need to do and the process time is quite long, then i do it in python Wand think i can speed up the time, but i stuck on this, the composite calculation look clamp all negative value.
在AfterEffect中,我需要使用32位图像深度来进行某种合成,我已经尝试了ImageMagick,结果是正确的,我可以在批处理命令中执行此操作,但是我需要做大的图层并且处理时间很长,然后我在python魔杖中做到了,我认为我可以加快时间,但是我坚持了这一点,复合计算看起来钳制了所有负值。
How can i get the right result using wand or other library? 我如何使用魔杖或其他库获得正确的结果? I also try PythonMagick and pgmagick but the result also like that.
我也尝试使用PythonMagick和pgmagick,但结果也是如此。 Thanks
谢谢
I'm using Wand 0.5.1 and ImageMagick version is ImageMagick-7.0.8-Q16-HDRI(64bit) , 我使用的是Wand 0.5.1,ImageMagick的版本是ImageMagick-7.0.8-Q16-HDRI(64bit),
here is my code and the sample: 这是我的代码和示例:
from wand import image as wi
from wand import api
img = wi.Image()
img.read(filename='D:\\0225_red.jpg')
img.convert('TIFF')
img.depth=24
api.library.MagickSetOption(img.wand,'quantum:format','floating-point')
api.library.MagickSetOption(img.wand,'compose:clamp','off')
img2=wi.Image()
img2.read(filename='D:\\0225_pink.jpg')
img2.convert('TIFF')
img2.depth=24
api.library.MagickSetOption(img2.wand,'quantum:format','floating-point')
api.library.MagickSetOption(img2.wand,'compose:clamp','off')
img3=wi.Image()
img3.read(filename='D:\\0225_blue.jpg')
img3.depth=24
api.library.MagickSetOption(img3.wand,'quantum:format','floating-point')
api.library.MagickSetOption(img3.wand,'compose:clamp','off')
img.composite_channel('all_channels',img2 , 'minus_src')
img.composite_channel('all_channels',img3 , 'plus')
img.format = 'TIFF'
img.save(filename='D:\\0225_test.tif')
The result from AE: AE的结果:
Result from my code: 我的代码的结果:
I would suspect the issue is related to the order of operations. 我怀疑问题与操作顺序有关。 Try the following...
尝试以下...
from wand.image import Image
with Image(filename='D:\\0225_red.jpg') as img:
img.options['quantum:format'] = 'floating-point'
img.options['compose:clamp'] = 'off'
with Image(filename='D:\\0225_blue.jpg') as blue:
img.composite_channel('all_channels', blue, 'plus')
with Image(filename='D:\\0225_pink.jpg') as pink:
img.composite_channel('all_channels', pink, 'minus_src')
img.save(filename='D:\\0225_test.tif')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.