问题
I have 3 images need to composite together, but the result dose not same as original result from AfterEffect compositing. 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.
How can i get the right result using wand or other library? I also try PythonMagick and pgmagick but the result also like that. Thanks
I'm using Wand 0.5.1 and ImageMagick version is 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:
Result from my code:
回答1:
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')
来源:https://stackoverflow.com/questions/54865438/image-composite-result-incorrect-using-python-wand