带 Python PILLOW 的虚线或虚线 [英] Dotted or dashed line with Python PILLOW
本文介绍了带 Python PILLOW 的虚线或虚线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用 Python PILLOW 绘制虚线或虚线或矩形.谁能帮我?使用 openCV 我可以做到这一点.但我想用枕头.
How to draw a dotted or dashed line or rectangle with Python PILLOW. Can anyone help me? Using openCV I can do that. But I want it using Pillow.
推荐答案
感谢@martineau 的评论,我想出了如何绘制虚线.这是我的代码.
Thanks to @martineau's comment, I figured out how to draw a dotted line. Here is my code.
cur_x = 0
cur_y = 0
image_width = 600
for x in range(cur_x, image_width, 4):
draw.line([(x, cur_y), (x + 2, cur_y)], fill=(170, 170, 170))
这将绘制一条灰色虚线.
This will draw a dotted line of gray color.
这篇关于带 Python PILLOW 的虚线或虚线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文