{"id":1447,"date":"2019-10-04T02:20:30","date_gmt":"2019-10-04T09:20:30","guid":{"rendered":"https:\/\/earthbound.io\/blog\/?p=1447"},"modified":"2020-10-20T11:11:44","modified_gmt":"2020-10-20T18:11:44","slug":"color-growth","status":"publish","type":"post","link":"https:\/\/earthbound.io\/blog\/color-growth\/","title":{"rendered":"Color growth from virtual bacteria (generative)"},"content":{"rendered":"<p>What happens if virtual bacteria emit color-mutating waste as they colonize? This 16 megapixel thing happens.<\/p>\n<p>[Later edit: and many other things. I have done many renders from this script, and evolved its functionality over time.]<\/p>\n<figure id=\"attachment_1683\" aria-describedby=\"caption-attachment-1683\" style=\"width: 768px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__16megapixels__bbeb28_colorGrowth-Py.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1683\" src=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__16megapixels__bbeb28_colorGrowth-Py-768x510.png\" alt=\"2019_10_04__16megapixels__bbeb28_colorGrowth-Py.png\" width=\"768\" height=\"510\" srcset=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__16megapixels__bbeb28_colorGrowth-Py-768x510.png 768w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__16megapixels__bbeb28_colorGrowth-Py-360x239.png 360w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__16megapixels__bbeb28_colorGrowth-Py-1366x906.png 1366w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__16megapixels__bbeb28_colorGrowth-Py-144x96.png 144w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><figcaption id=\"caption-attachment-1683\" class=\"wp-caption-text\">2019_10_04__16megapixels__bbeb28_colorGrowth-Py.png<\/figcaption><\/figure>\n<p>Inspired by this <a href=\"https:\/\/scipython.com\/blog\/computer-generated-contemporary-art\/\">computer generated contemporary art<\/a> post (and after I got the script to work and posted it <a href=\"https:\/\/github.com\/earthbound19\/_ebDev\/blob\/master\/scripts\/imgAndVideo\/color_fibers.py\">here<\/a>), I wondered what the visual result would be from an algorithm like this:<\/p>\n<p>&#8211; paint a canvas with a base color<br \/>\n&#8211; pick a random coordinate on it<br \/>\n&#8211; mutate the color at that coordinate a bit<br \/>\n&#8211; randomly walk in any direction<br \/>\n&#8211; mutate a bit from the previous color, then drop that color there<br \/>\n&#8211; repeat (but don't repeat on already used coordinates)<br \/>\n&#8211; if all adjacent coordinates have been colored, pick a new random coordinate on the canvas [later versions of the script, which has evolved over time: OR DIE]<br \/>\n&#8211; repeat (this is less necessary if the virtual bacteria colonize: ) [OR DON'T, as other \"living\" coordinates will repeat the process<br \/>\n&#8211; [Later script versions: activate orphan coordinates that no bacteria ever reached, and start the process with them.]<\/p>\n<p>Then I wondered what happens if the bacteria duplicate&#8211;if they create mutated copies of themselves which repeat the same thing, so that you get spreading colonies of color-pooping bacteria.<\/p>\n<p>I got a python script working that accomplished this, and while with great patience it produced amazing output, I was frustrated with the inefficiency of it (a high resolution render took a day), and wondered how to make it faster.<\/p>\n<p>Someone with the username \"scribblemaniac\" at github apparently took notice of image posts I made linking to this script, and they figured out how to speed it up by many orders of magnitude, and opened <a href=\"https:\/\/github.com\/earthbound19\/_ebDev\/pull\/21\">a pull request<\/a> with <a href=\"https:\/\/github.com\/earthbound19\/_ebDev\/blob\/master\/scripts\/imgAndVideo\/color_growth_fast.py\">a new version of the script<\/a>. (They also added features. And used a new file name. I merged the request.) [Edit: I later merged their script over the original name, and copied my original script to color_growth_v1.py.] The above image is from the new version. It took ~7 minutes to render. <a href=\"https:\/\/github.com\/earthbound19\/_ebDev\/blob\/master\/scripts\/imgAndVideo\/color_growth.py\">The old version<\/a> would have taken maybe 2 days. (If the link to the new version goes bad it's because I tested and integrated or copied the new version over the old file name).<\/p>\n<p>In a compiled language, it might be much faster.<\/p>\n<p>I did all this unaware that someone else <a href=\"https:\/\/codegolf.stackexchange.com\/a\/22326\/79433\">won a \"code golf\" challenge<\/a> by coming up with the same concept, except using colors differently. (There are all kinds of gorgeous generative art results in various answers there!&#8211;go have fun and get lost in them!) Their source code is down and forsaken apparently, but someone in the comments describes speeding up the process in several languages and ultimately making a lighting fast C++ program, <a href=\"https:\/\/github.com\/mumbleskates\/color-deposit-cc\">the source of which is over here<\/a>. Breathtaking output examples <a href=\"https:\/\/imgur.com\/a\/LJuD4ya\">are over here<\/a>. Their purpose is slightly different: use all colors in the RGB color space. Their source could probably be tweaked to use all colors from a list.<\/p>\n<p>Here are other outputs from the program (which might now show up in syndicated posts&#8211;look up the original post URL given.)<\/p>\n<figure id=\"attachment_2984\" aria-describedby=\"caption-attachment-2984\" style=\"width: 768px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/PUBLISHED_2019_10_04__16_49_47__ca6505_colorGrowth-Py.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2984 size-medium\" src=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/PUBLISHED_2019_10_04__16_49_47__ca6505_colorGrowth-Py-768x432.png\" alt=\"2019_10_04__16_49_47__ca6505_colorGrowth-Py\" width=\"768\" height=\"432\" srcset=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/PUBLISHED_2019_10_04__16_49_47__ca6505_colorGrowth-Py-768x432.png 768w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/PUBLISHED_2019_10_04__16_49_47__ca6505_colorGrowth-Py-1366x768.png 1366w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/PUBLISHED_2019_10_04__16_49_47__ca6505_colorGrowth-Py-360x203.png 360w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/PUBLISHED_2019_10_04__16_49_47__ca6505_colorGrowth-Py-1536x864.png 1536w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/PUBLISHED_2019_10_04__16_49_47__ca6505_colorGrowth-Py-668x376.png 668w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/PUBLISHED_2019_10_04__16_49_47__ca6505_colorGrowth-Py.png 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><figcaption id=\"caption-attachment-2984\" class=\"wp-caption-text\">color growth script output<\/figcaption><\/figure>\n<figure id=\"attachment_2986\" aria-describedby=\"caption-attachment-2986\" style=\"width: 768px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_57_32__755c0c_colorGrowth-Py.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2986 size-medium\" src=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_57_32__755c0c_colorGrowth-Py-768x432.png\" alt=\"2019_10_04__17_57_32__755c0c_colorGrowth-Py\" width=\"768\" height=\"432\" srcset=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_57_32__755c0c_colorGrowth-Py-768x432.png 768w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_57_32__755c0c_colorGrowth-Py-1366x768.png 1366w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_57_32__755c0c_colorGrowth-Py-360x203.png 360w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_57_32__755c0c_colorGrowth-Py-1536x864.png 1536w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_57_32__755c0c_colorGrowth-Py-668x376.png 668w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_57_32__755c0c_colorGrowth-Py.png 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><figcaption id=\"caption-attachment-2986\" class=\"wp-caption-text\">color growth script output<\/figcaption><\/figure>\n<figure id=\"attachment_2987\" aria-describedby=\"caption-attachment-2987\" style=\"width: 768px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_59_22__989252_colorGrowth-Py.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2987 size-medium\" src=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_59_22__989252_colorGrowth-Py-768x432.png\" alt=\"2019_10_04__17_59_22__989252_colorGrowth-Py\" width=\"768\" height=\"432\" srcset=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_59_22__989252_colorGrowth-Py-768x432.png 768w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_59_22__989252_colorGrowth-Py-1366x768.png 1366w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_59_22__989252_colorGrowth-Py-360x203.png 360w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_59_22__989252_colorGrowth-Py-1536x864.png 1536w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_59_22__989252_colorGrowth-Py-668x376.png 668w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__17_59_22__989252_colorGrowth-Py.png 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><figcaption id=\"caption-attachment-2987\" class=\"wp-caption-text\">color growth script output<\/figcaption><\/figure>\n<figure id=\"attachment_1688\" aria-describedby=\"caption-attachment-1688\" style=\"width: 768px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__18_03_49__4a1dd2_colorGrowth-Py.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1688\" src=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__18_03_49__4a1dd2_colorGrowth-Py-768x432.png\" alt=\"color growth script output\" width=\"768\" height=\"432\" srcset=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__18_03_49__4a1dd2_colorGrowth-Py-768x432.png 768w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__18_03_49__4a1dd2_colorGrowth-Py-360x203.png 360w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__18_03_49__4a1dd2_colorGrowth-Py-1366x768.png 1366w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__18_03_49__4a1dd2_colorGrowth-Py-144x81.png 144w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__18_03_49__4a1dd2_colorGrowth-Py.png 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><figcaption id=\"caption-attachment-1688\" class=\"wp-caption-text\">color growth script output<\/figcaption><\/figure>\n<figure id=\"attachment_1689\" aria-describedby=\"caption-attachment-1689\" style=\"width: 768px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__15_33_21__bbeb28_colorGrowth-Py.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1689\" src=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__15_33_21__bbeb28_colorGrowth-Py-768x432.png\" alt=\"color growth script output with default settings but high resolution\" width=\"768\" height=\"432\" srcset=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__15_33_21__bbeb28_colorGrowth-Py-768x432.png 768w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__15_33_21__bbeb28_colorGrowth-Py-360x203.png 360w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__15_33_21__bbeb28_colorGrowth-Py-1366x768.png 1366w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__15_33_21__bbeb28_colorGrowth-Py-144x81.png 144w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__15_33_21__bbeb28_colorGrowth-Py.png 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><figcaption id=\"caption-attachment-1689\" class=\"wp-caption-text\">color growth script output with default settings but high resolution<\/figcaption><\/figure>\n<figure id=\"attachment_1690\" aria-describedby=\"caption-attachment-1690\" style=\"width: 768px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__18_11_27__3c3b36_colorGrowth-Py.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1690\" src=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__18_11_27__3c3b36_colorGrowth-Py-768x432.png\" alt=\"color growth script output + high res\" width=\"768\" height=\"432\" srcset=\"https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__18_11_27__3c3b36_colorGrowth-Py-768x432.png 768w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__18_11_27__3c3b36_colorGrowth-Py-360x203.png 360w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__18_11_27__3c3b36_colorGrowth-Py-144x81.png 144w, https:\/\/earthbound.io\/blog\/wp-content\/uploads\/2019_10_04__18_11_27__3c3b36_colorGrowth-Py.png 1280w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><figcaption id=\"caption-attachment-1690\" class=\"wp-caption-text\">color growth script output + high res<\/figcaption><\/figure>\n<p>These are from randomly chosen RGB colors, which, as I went into in another post, <a href=\"https:\/\/earthbound.io\/blog\/superior-color-sort-with-ciecam02-python\/\">tend to produce horrible color combinations<\/a>. Le sigh, random pick from CIECAM02 space might be awesome..<\/p>\n<p>I dedicate all the images in this post to the Public Domain.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What happens if virtual bacteria emit color-mutating waste as they colonize? This 16 megapixel thing happens. [Later edit: and many other things. I have done many renders from this script, and evolved its functionality over time.] Inspired by this computer generated contemporary art post (and after I got the script to work and posted it [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1683,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"gallery","meta":{"inline_featured_image":false,"mf2_syndication":["https:\/\/www.flickr.com\/photos\/alexhall\/48844623456","https:\/\/www.instagram.com\/p\/B3N2mwTB6SE","https:\/\/www.pinterest.com\/pin\/524950900317940894","https:\/\/twitter.com\/earthbound19\/status\/1180279113422135296"],"webmentions_disabled_pings":false,"webmentions_disabled":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[67],"tags":[404,126,300,364,413,302,299],"class_list":{"0":"post-1447","1":"post","2":"type-post","3":"status-publish","4":"format-gallery","5":"has-post-thumbnail","7":"category-uncategorized","8":"tag-abstractart","9":"tag-art-resources","10":"tag-bacteria","11":"tag-color-growth","12":"tag-generativeart","13":"tag-python","14":"tag-simulation","15":"post_format-post-format-gallery","16":"h-entry","17":"hentry"},"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/earthbound.io\/blog\/wp-json\/wp\/v2\/posts\/1447","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/earthbound.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/earthbound.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/earthbound.io\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/earthbound.io\/blog\/wp-json\/wp\/v2\/comments?post=1447"}],"version-history":[{"count":0,"href":"https:\/\/earthbound.io\/blog\/wp-json\/wp\/v2\/posts\/1447\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/earthbound.io\/blog\/wp-json\/wp\/v2\/media\/1683"}],"wp:attachment":[{"href":"https:\/\/earthbound.io\/blog\/wp-json\/wp\/v2\/media?parent=1447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/earthbound.io\/blog\/wp-json\/wp\/v2\/categories?post=1447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/earthbound.io\/blog\/wp-json\/wp\/v2\/tags?post=1447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}