gpt4 book ai didi

python - 带有 Python PILLOW 的点线或虚线

转载 作者:行者123 更新时间:2023-11-28 17:04:33 24 4
gpt4 key购买 nike

如何使用 Python PILLOW 绘制点线或虚线或矩形。谁能帮我?使用 openCV 我可以做到这一点。但我希望使用 Pillow。

最佳答案

感谢@martineau 的评论,我想出了如何画一条虚线。这是我的代码。

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

这将绘制一条灰色的虚线。

关于python - 带有 Python PILLOW 的点线或虚线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51908563/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com