from CyberKinesis https://boingboing.net/2016/05/10/unflattening-a-graphic-di.html