composite()函數使用COMPOSITE_OPERATORS在繪製對象圖像的頂部渲染圖像。必須為合成圖像指定目標的上,左,寬和高值。
用法: wand.drawing.composite(image, left, top, operator, arguments, gravity)
參數:
參數 | 輸入類型 | 描述 |
---|---|---|
image | wand.image.Image | 放置在當前圖像上的圖像 |
left | numbers.Integral | 放置圖片的X坐標 |
top | numbers.Integral | 圖像放置的y坐標 |
operator | basestring | 影響合成物如何應用到圖像的運算符。 |
arguments | basestring | 作為幾何字符串或逗號分隔值給出的附加數字。 ‘blend’,‘displace’,‘dissolve’和‘modulate’運算符需要此設置。 |
gravity | basestring | 根據GRAVITY_TYPES的重力值計算上下左右的值。 |
以下是COMPOSITE_OPERATORS的列表:
(‘undefined’, ‘alpha’, ‘atop’, ‘blend’, ‘blur’, ‘bumpmap’, ‘change_mask’, ‘clear’, ‘color_burn’, ‘color_dodge’, ‘colorize’, ‘copy_black’, ‘copy_blue’, ‘copy’, ‘copy_cyan’, ‘copy_green’, ‘copy_magenta’, ‘copy_alpha’, ‘copy_red’, ‘copy_yellow’, ‘darken’, ‘darken_intensity’, ‘difference’, ‘displace’, ‘dissolve’, ‘distort’, ‘divide_dst’, ‘divide_src’, ‘dst_atop’, ‘dst’, ‘dst_in’, ‘dst_out’, ‘dst_over’, ‘exclusion’, ‘hard_light’, ‘hard_mix’, ‘hue’, ‘in’, ‘intensity’, ‘lighten’, ‘lighten_intensity’, ‘linear_burn’, ‘linear_dodge’, ‘linear_light’, ‘luminize’, ‘mathematics’, ‘minus_dst’, ‘minus_src’, ‘modulate’, ‘modulus_add’, ‘modulus_subtract’, ‘multiply’, ‘no’, ‘out’, ‘over’, ‘overlay’, ‘pegtop_light’, ‘pin_light’, ‘plus’, ‘replace’, ‘saturate’, ‘screen’, ‘soft_light’, ‘src_atop’, ‘src’, ‘src_in’, ‘src_out’, ‘src_over’, ‘threshold’, ‘vivid_light’, ‘xor’, ‘stereo’)
輸入圖像:
圖片#1:
圖片2:
範例1:
from wand.image import Image, COMPOSITE_OPERATORS
from wand.drawing import Drawing
from wand.display import display
gog = Image(filename ='gog.png')
road = Image(filename ='rd.jpg')
g = gog.clone()
r = road.clone()
with Drawing() as draw:
# composite image with color_burn operator
draw.composite(operator ='color_burn', left = 20, top = 30,
width = r.width, height = r.height, image = r)
draw(g)
g.save(filename ="colorburn.png")
display(g)
輸出:
範例1:
from wand.image import Image, COMPOSITE_OPERATORS
from wand.drawing import Drawing
from wand.display import display
gog = Image(filename ='gog.png')
road = Image(filename ='rd.jpg')
g = gog.clone()
r = road.clone()
with Drawing() as draw:
# composite image with dissolve operator
draw.composite(operator = 'luminize', left = 20, top = 30,
width = g.width, height = g.height, image = g)
draw(r)
r.save(filename ="dissolve.png")
display(r)
輸出:
相關用法
- Python Wand function()用法及代碼示例
- Python Wand gaussian_blur()用法及代碼示例
- Python Wand transform()用法及代碼示例
- Python Wand crop()用法及代碼示例
- Python Wand rotational_blur()用法及代碼示例
- Python Wand Image()用法及代碼示例
- Python Wand shade()用法及代碼示例
- Python Wand sharpen()用法及代碼示例
- Python Wand adaptive_sharpen()用法及代碼示例
- Python Wand noise()用法及代碼示例
- Python Wand blue_shift()用法及代碼示例
- Python Wand color_matrix()用法及代碼示例
- Python Wand unsharp_mask()用法及代碼示例
- Python Wand colorize()用法及代碼示例
- Python Wand fx()用法及代碼示例
注:本文由純淨天空篩選整理自RahulSabharwal大神的英文原創作品 Wand composite() function in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。