2016-05-09 43 views
0

形阴影是否有相当于功能:用魔杖

convert -background none -stroke black -fill white \ 
     -font Candice -pointsize 48 label:A -trim \ 
     \(+clone -background navy -shadow 80x3+3+3 \) +swap \ 
     -background none -layers merge +repage shadow_a.png 

将会产生一个“A”有蓝色阴影。

我已经彻底搜索了文档,但找不到任何东西。
这只是不可能吗?

回答

2

并不是所有的CLI方法都存在于与集成的C-API库中。但是,大多数行为方法都很简单(例如+swap),并且您可以在应用程序认为合适时自由实施它们。

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') 

Shaped shadow with wand

+0

嘛,悲伤,但仍感谢。 – MCManuelLP