Python 3 Gizeh Library Script to Export Circle Vector Graphics as PNG Image

Python 3 Gizeh Library Script to Export Circle Vector Graphics as PNG Image

Python 3 Gizeh Library Script to Export Circle Vector Graphics as PNG Image

import gizeh

# initialize surface
surface = gizeh.Surface(width=500, height=260) # in pixels

# Now make a shape and draw it on the surface
circle = gizeh.circle(r=90, xy= [150,120], fill=(0,0,0))
circle.draw(surface)

# Now export the surface
surface.get_npimage() # returns a (width x height x 3) numpy array
surface.write_to_png("circle.png")
Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment