【发布时间】:2019-02-25 11:44:21
【问题描述】:
我有 3 张图像需要合成在一起,但结果与 AfterEffect 合成的原始结果不同。在 AfterEffect 中,我需要使用 32 位图像深度进行一些合成,我尝试了 ImageMagick,结果是正确的,我可以在批处理命令中完成,但我需要做的图层很大,处理时间很长,然后我在 python Wand 中做它认为我可以加快时间,但我坚持这一点,复合计算看起来钳制所有负值。
如何使用 wand 或其他库获得正确的结果?我也尝试过 PythonMagick 和 pgmagick,但结果也是如此。谢谢
我使用的是 Wand 0.5.1,ImageMagick 版本是 ImageMagick-7.0.8-Q16-HDRI(64bit) ,
这是我的代码和示例:
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')
AE的结果:
我的代码结果:
【问题讨论】:
-
你能发布原始图像,所以我们有一些东西可以展示吗?有效的 CLI 命令也很有帮助。