Icon ASCII : A Love Letter


Icon My Neural Network isn't working! What should I do?


Icon Phase-Functioned Neural Networks for Character Control


Icon 17 Line Markov Chain


Icon 14 Character Random Number Generator


Icon Simple Two Joint IK


Icon Generating Icons with Pixel Sorting


Icon Neural Network Ambient Occlusion


Icon Three Short Stories about the East Coast Main Line


Icon The New Alphabet


Icon "The Color Munifni Exists"


Icon A Deep Learning Framework For Character Motion Synthesis and Editing


Icon The Halting Problem and The Moral Arbitrator


Icon The Witness


Icon Four Seasons Crisp Omelette


Icon At the Bottom of the Elevator


Icon Tracing Functions in Python


Icon Still Things and Moving Things


Icon water.cpp


Icon Making Poetry in Piet


Icon Learning Motion Manifolds with Convolutional Autoencoders


Icon Learning an Inverse Rig Mapping for Character Animation


Icon Infinity Doesn't Exist


Icon Polyconf


Icon Raleigh


Icon The Skagerrak


Icon Printing a Stack Trace with MinGW


Icon The Border Pines


Icon You could have invented Parser Combinators


Icon Ready for the Fight


Icon Earthbound


Icon Turing Drawings


Icon Lost Child Announcement


Icon Shelter


Icon Data Science, how hard can it be?


Icon Denki Furo


Icon In Defence of the Unitype


Icon Maya Velocity Node


Icon Sandy Denny


Icon What type of Machine is the C Preprocessor?


Icon Which AI is more human?


Icon Gone Home


Icon Thoughts on Japan


Icon Can Computers Think?


Icon Counting Sheep & Infinity


Icon How Nature Builds Computers


Icon Painkillers


Icon Correct Box Sphere Intersection


Icon Avoiding Shader Conditionals


Icon Writing Portable OpenGL


Icon The Only Cable Car in Ireland


Icon Is the C Preprocessor Turing Complete?


Icon The aesthetics of code


Icon Issues with SDL on iOS and Android


Icon How I learned to stop worrying and love statistics


Icon PyMark


Icon AutoC Tools


Icon Scripting xNormal with Python


Icon Six Myths About Ray Tracing


Icon The Web Giants Will Fall


Icon PyAutoC


Icon The Pirate Song


Icon Dear Esther


Icon Unsharp Anti Aliasing


Icon The First Boy


Icon Parallel programming isn't hard, optimisation is.


Icon Skyrim


Icon Recognizing a language is solving a problem


Icon Could an animal learn to program?




Icon Pure Depth SSAO


Icon Synchronized in Python


Icon 3d Printing


Icon Real Time Graphics is Virtual Reality


Icon Painting Style Renderer


Icon A very hard problem


Icon Indie Development vs Modding


Icon Corange


Icon 3ds Max PLY Exporter


Icon A Case for the Technical Artist


Icon Enums


Icon Scorpions have won evolution


Icon Dirt and Ashes


Icon Lazy Python


Icon Subdivision Modelling


Icon The Owl


Icon Mouse Traps


Icon Updated Art Reel


Icon Tech Reel


Icon Graphics Aren't the Enemy


Icon On Being A Games Artist


Icon The Bluebird


Icon Everything2


Icon Duck Engine


Icon Boarding Preview


Icon Sailing Preview


Icon Exodus Village Flyover


Icon Art Reel




Icon One Cat Just Leads To Another

Generating Icons with Pixel Sorting

Created on Jan. 14, 2017, 12:27 p.m.

Many sites these days provide randomly generated images for avatars if the user hasn't uploaded their own image. For example Github provides identicons which are generated using the hash of the username. These sorts of random icons are also useful for other purposes - on my most recent project, ./code --poetry I wanted to try generating random abstract icons to identify different poems. Here are a selection of the final results:

As you can see each one is very unique with its own character. Like with the Github identicons, I wanted to make it clear that the icons were computer generated, keeping the abstract, computational, pixelated look. But because these icons were also going to be used to represent poems I wanted to create icons which were naturally emotive and could be easily matched with poems that seemed to portray similar feelings. To do this I took inspiration from Movie Barcodes and pixel sorting - both of which seem to so easily capture the emotion of an image in an abstract way.

But this kind of glitch art is often only as good as the source image - using random images from google was unlikely to produce anything nice. Luckily an almost endless supply of incredible photography exists via Flikr's best of the week section. This gives us a constant source of images with beautiful colors and interesting compositions.

I started by crawling the best of the week page with Python and extracting all the links using Beautiful Soup.

from urllib.request import Request, urlopen
from bs4 import BeautifulSoup

flikr = 'http://www.flickr.com'
header = {
        'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 '+
        '(KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36'
requ = Request(flikr+"/explore/interesting/7days/", headers=header)
soup = BeautifulSoup(urlopen(requ).read())
imgs = soup.findAll('img', "pc_img")

For each link on the page we can get the link url, and modify it a little bit to load up the page containing the smallest version of the image. We can then download the image to a temporary file and using Numpy/Scipy/Pillow we can resize/pixelate the image and pixel sort it with a few simple functions.

for qi, query in enumerate(imgs):
    requ = Request(flikr+query.parent['href']+'sizes/s/', headers=header)
    soup = BeautifulSoup(urlopen(requ).read())
    requ_img = Request(soup.findAll('img')[2]['src'], headers=header)
    import tempfile
    f = tempfile.TemporaryFile()

    import numpy as np
    import scipy.misc as misc

    img = misc.imread(f)
    img = misc.imresize(img, (16, 16), 'nearest')
    img = np.sort(img, axis=0)
    img = misc.imresize(img, (64, 64), 'nearest')
    misc.imsave('icon_%03i.png' % qi, img)

And that's it! The best of the week page gives you different results every time so put the whole thing in a loop and enjoy your new set of pixel sorted icons. Just remember to crawl responsibly!

github twitter rss