DEV Community

Ice or Fire
Ice or Fire

Posted on

1 1

How do I turn an image into polygon art with python?

If I have a "normal" source image, how do I use python to change it into a new image composed of just colored polygons and/or triangles? Can the PIL do this? Thanks!

Top comments (1)

Collapse
 
iceorfiresite profile image
Ice or Fire

Answer copied from a reddit post:

This is actually a pretty hard computer science problem, and you may be better off using existing software tools rather than writing your own. However, it may be a fun learning project. What you want to google is "algorithm convert bitmap to vector". Your "normal image" is a bitmap image: a grid of colored pixels. And you want to convert it to a list of colored shapes, which is called a vector image.

This twitter feed has some examples: twitter.com/PrimitivePic

It has a brief explanation here: primitive.lol/

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay