{"id":3626,"date":"2016-06-16T00:20:07","date_gmt":"2016-06-16T08:20:07","guid":{"rendered":"http:\/\/bendwavy.org\/wp\/?p=3626"},"modified":"2016-07-08T13:03:19","modified_gmt":"2016-07-08T21:03:19","slug":"fun-with-colors","status":"publish","type":"post","link":"https:\/\/bendwavy.org\/wp\/?p=3626","title":{"rendered":"fun with colors"},"content":{"rendered":"<p>Here, have a couple of Python scripts.  Each creates an image file, 2^12 pixels square, each pixel of a different color.<\/p>\n<p><a href=\"\/source\/colorshuffle.py\">colorshuffle.py<\/a> puts the coordinates of each pixel in Gray code, assigns each bit to one of the color channels, and converts each channel back from Gray code to choose a color.  The assignment is chosen at random from 141926400 possibilities.<\/p>\n<p><a href=\"\/source\/colorfold.py\">colorfold.py<\/a> is my attempt to re-create and extend <a href=\"https:\/\/allrgb.com\/unfolded-color-cube\">this<\/a>: it folds the square eight times to make a cube fitting the color space.  The interesting part was maintaining continuity through multiple folds.  This one has only 107520 possible outcomes; again they&#8217;re chosen at random.  I don&#8217;t like the result nearly as much as the other, but you might!<\/p>\n<p>You&#8217;ll need <a href=\"http:\/\/www.pythonware.com\/products\/pil\/\">Python Imaging Library<\/a>.<\/p>\n<p>On my machine each takes less than two minutes, so with a simple shell script you can whip up hundreds overnight.<\/p>\n<p><!--more-->Here are lines folded four times, left over right or right over left.  Half of the cases have a small continuity flaw near the original ends; I&#8217;ll look into that later.<br \/>\n<img decoding=\"async\" src=\"\/doodle\/snakes-d1.svg\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here, have a couple of Python scripts. Each creates an image file, 2^12 pixels square, each pixel of a different color. colorshuffle.py puts the coordinates of each pixel in Gray code, assigns each bit to one of the color channels, &hellip; <a href=\"https:\/\/bendwavy.org\/wp\/?p=3626\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,4],"tags":[],"class_list":["post-3626","post","type-post","status-publish","format-standard","hentry","category-eye-candy","category-neep-neep"],"_links":{"self":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3626"}],"version-history":[{"count":7,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3626\/revisions"}],"predecessor-version":[{"id":3638,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/3626\/revisions\/3638"}],"wp:attachment":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}