What does it do?

Linify programmatically converts any image into a drawing made completely of straight full-length lines. Click any of the images to see them reconstructed. Linify was inspired by this reddit post.

Who made it?

Email: linifyme at gmail dot com

Twitter: @LINIFYme



How does it work?

Linify uses a greedy randomized algorithm. First, the darkest pixel is found. Then a number of random lines are drawn through that point, and the pixel values along each line are added together. The line with the darkest average is chosen, and the value of that line is subtracted from the image. Then the whole process is started over again for however many lines we are drawing. By the nature of the algorithm, the optimal line drawing configuration is probably not achieved, but performance is far superior to the naive method of checking every line.

How are the images stored?

To store Linify images in a compact form for replayability, every line drawn for each image has to be stored. This is accomplished by numbering the edges of the image 0-2047 for a 512x512 image. Thus a line can be expressed as 2 11-bit numbers (2^11 = 2048). Including 2 bits for color (gray, red, green, blue), a complete line can be encoded 24 bits. To be able to produce displayable images for thumbnails and social media, each saved image is uploaded to Imgur.

Tech used

Linify uses icons from Font Awesome. Imgur is used to store images. crossorigin.me is used as a CORS proxy. The backend uses a combination of Node.js and Nginx.

Inspiration Gallery