【发布时间】:2021-09-24 09:49:09
【问题描述】:
我知道如何在普通 SVG 文件上执行此任务,但我在 python 3.7 中使用svgwrite 包,但我不知道如何执行此操作。可悲的是website documentation 没有足够准确地涵盖这个主题......
这是我想出的代码,但它不起作用:
image.add(image.ellipse(center=(half_x, half_y), r=(340, 340), fill=line_color, cx=50, cy=50, rx=80, ry=60, stroke="rgb(255,255,255)", opacity=0.3, stroke_width="0.5", id="img-container"))
image.add(image.image(href="https://images.pexels.com/photos/799443/pexels-photo-799443.jpeg", insert=None, size=("100%","100%"), clip_path="img-container"))
我只想在我的 SVG 文件中有一个圆形图像。如果您知道任何更好的方法,请告诉我!
编辑:当我想使用clipPath 时,我得到了以下错误:
ValueError: Invalid children 'image' for svg-element <clipPath>.
【问题讨论】: