from Hacker News

Show HN: Mosaic Shapes for macOS

by Liuser on 3/4/17, 2:04 PM with 2 comments

  • by Liuser on 3/4/17, 2:07 PM

    This has been a fun little project that began during the holiday season last year. I got a lot of inspiration visiting SFMoMA late last year and had a strong desire to dissect some of the artwork I saw and to see if I could create something similar. I thought it'd be a good exercise to decipher and see if one could formulate the algorithm some of these artists are using and then be able to apply said algorithm to arbitrary subjects. I'm going to beat around the bush and not say the artist that inspired this (shouldn't be difficult to tell), I've found some articles online that they don't want any outside projects with their name referenced on it so I'll respect those wishes. I've tried some neural-networks to see if I could extract features and apply it to another image, but in this instance I got better results with a procedural approach.

    The core is written in Python and nested in the Cocoa app. It uses scikit-image and PIL libraries. I actually originally wrote this project as a web application that allowed users to convert images online. It had an easy to use mobile web interface for users to upload images and download conversion. The upsell was for users to pay for high resolution images. I ultimately decided to remove the web app because I felt the quality of the images it was producing wasn't that great due to certain technical constraints.

    It takes real estate to draw the nested shapes, thus drawing work better on larger images. The conversion is inherently CPU intensive. The server I was renting had one processor and 512 RAM, which works well for images less than 1000 pixels. Anything larger requires some gymnastics such as cutting the picture into 100 smaller pictures, processing, then stitching it back together. I also didn't want to upgrade the servers too much because that becomes a re-occuring high monthly cost for a small project with a low feature set.

    Next steps: - Working on some additional effects. - Vector output. PIL doesn't support vector output by default, but was easy to hit the ground running with. pycairo would be a good candidate.

  • by owly on 3/5/17, 1:44 PM

    Nice work!