Not all CLI methods are present in the C-API library which wand integrates with. However, most behavior methods are straight forward (e.g. +swap
), and you are free to implement them as your application sees fit.
from wand.image import Image
from wand.color import Color
from wand.drawing import Drawing
from wand.compat import nested
with nested(Image(width=100, height=100, background=Color("transparent")),
Image(width=100, height=100, background=Color("transparent"))) as (text,
shadow):
with Drawing() as ctx:
ctx.stroke_color = Color("black")
ctx.fill_color = Color("white")
ctx.font_size = 48
ctx.text(text.width/2, text.height/2, 'A')
ctx(text)
with Drawing() as ctx:
ctx.fill_color = Color("navy")
ctx.font_size = 48
ctx.text(text.width/2, text.height/2, 'A')
ctx(shadow)
shadow.gaussian_blur(80, 3)
shadow.composite(text, -3, -3)
shadow.trim()
shadow.save(filename='shadow_a.png')
