Why Nostr? What is Njump?
2024-07-06 00:54:07

0x10f on Nostr: Trying to approximate an image by drawing random rectangles: 1) Start with a blank ...

Trying to approximate an image by drawing random rectangles:
1) Start with a blank canvas (initialised to the average colour of the target image).
2) Draw a rectangle with random width, height, X position, Y position and colour.
3) If the rectangle makes the difference between current image and target image smaller, continue, otherwise undo the previous step.
4) Go to 2.

Left image: Doom title screen. Right image: 320 rectangles added to a blank canvas.

Source code (messy): https://pastebin.com/mpvK2LKQ

#programming #graphics


Author Public Key
npub1tp9nxg373mjkamr84qc8zg2f86eu2sqztrlnk22h38snhxs4y7lq04tyk4