【发布时间】:2021-11-09 04:26:34
【问题描述】:
我正在尝试复制一些注释示例。下面是我的代码,我想知道出了什么问题。
from wand.font import Font
from wand.image import Image
from wand.display import display
file1 = 'Lenna.jpg' #Download from here https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png
myImage = Image(filename=file1)
myImage.font = Font('C:\\Users\\User1\\Documents\\FONTS\\cyrvetic.ttf')
myImage.GRAVITY_TYPES=("southeast")
myImage.caption = ("Some text here",50,50,200,200)
display(myImage)
最终我想复制这个命令:
convert Lenna.jpg -fill white -undercolor '#00000080' -pointsize 24 -gravity SouthEast -annotate +50+10 "Some text here" Lenna2.jpg
知道上面的代码出了什么问题吗?
谢谢。
【问题讨论】:
-
你为什么认为有问题?
-
为什么在 Python Wand 中不用注释而不是标题?
-
谢谢。很难找到正确的文档(用于 python/wand)。我尝试了注释并得到了它,但找不到更改字体颜色的选项。我期待它是 font_color 或 text_color,但都不存在。我在深色背景上收到深色字母。
-
尝试在注释之前设置 fill_color 和/或 stroke_color 属性
-
谢谢。我发现了一些其他的帖子。它适用于 Windows,但在 Linux 上我得到 AttributeError: 'Image' object has no attribute 'annotate'。
标签: python imagemagick wand