{"id":105,"date":"2018-03-19T14:33:29","date_gmt":"2018-03-19T12:33:29","guid":{"rendered":"http:\/\/harrikemppainen.com\/en\/?p=105"},"modified":"2018-03-19T14:51:16","modified_gmt":"2018-03-19T12:51:16","slug":"rgb-sorting","status":"publish","type":"post","link":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/","title":{"rendered":"RGB sorting"},"content":{"rendered":"<h1>Sorting RGB values<\/h1>\n<h2>Background<\/h2>\n<p>I heard of <a href=\"http:\/\/satyarth.me\/articles\/pixel-sorting\/\">pixel sorting<\/a>\u00a0and glitch art sometimes last year. It sounded interesting and something a guy with programming background could try. And I did try. Results weren&#8217;t that impressive, but I have to admit I didn&#8217;t do proper research on the subject.\u00a0I used <a href=\"http:\/\/ccl.northwestern.edu\/netlogo\/\">Netlogo<\/a>\u00a0on my tests and I just sorted pixels, I didn&#8217;t analyse areas of the image first.<br \/>\nAs my mind usually does it wondered to other paths and I thought of sorting RGB values of pixels. There was just one big problem; Netlogo uses huge amounts of memory and it was practical only to quite\u00a0 small sized images, so I needed another tool. For a while I was exited about scripting Photoshop, but at least CS6 version doesn&#8217;t seem to offer easy (or any) access to pixels. Silly me, I should have known and checked <a href=\"https:\/\/processing.org\/\">Processing<\/a>\u00a0straight away. It does have all that I needed: simple functions to load, create and store images, easy access to pixels and RGB values and it manages a 12000 by 12000 pixel image just fine.<\/p>\n<h2>Sorting RGB<\/h2>\n<figure id=\"attachment_109\" aria-describedby=\"caption-attachment-109\" style=\"width: 300px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-109\" src=\"http:\/\/harrikemppainen.com\/en\/wp-content\/uploads\/2018\/03\/Fibonacci_and_ferry-300x300.jpg\" alt=\"Six images with Sorted RGB values side by side. Sorting RGB values tint images\" width=\"300\" height=\"300\" srcset=\"http:\/\/harrikemppainen.com\/en\/wp-content\/uploads\/2018\/03\/Fibonacci_and_ferry-300x300.jpg 300w, http:\/\/harrikemppainen.com\/en\/wp-content\/uploads\/2018\/03\/Fibonacci_and_ferry-150x150.jpg 150w, http:\/\/harrikemppainen.com\/en\/wp-content\/uploads\/2018\/03\/Fibonacci_and_ferry-768x768.jpg 768w, http:\/\/harrikemppainen.com\/en\/wp-content\/uploads\/2018\/03\/Fibonacci_and_ferry-1024x1024.jpg 1024w, http:\/\/harrikemppainen.com\/en\/wp-content\/uploads\/2018\/03\/Fibonacci_and_ferry-1440x1440.jpg 1440w, http:\/\/harrikemppainen.com\/en\/wp-content\/uploads\/2018\/03\/Fibonacci_and_ferry.jpg 1920w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><figcaption id=\"caption-attachment-109\" class=\"wp-caption-text\">Six RGB sorted frames side by side<\/figcaption><\/figure>\n<p>Idea was simple enough, find witch value is biggest, smallest and the middle one of a pixel. Then reorder them so that R always has the biggest value, G the middle on and B has lowest value. Or any other combination of RGB, so there are six different combinations in total. It&#8217;s a bit painstaking to create and compare all six versions separately so I made a bit more code and combined all six variants to a same image file. And that created the surprise side effect: Picture reminded me quite a lot of <a href=\"https:\/\/www.moma.org\/collection\/works\/portfolios\/61240?locale=en\">Andy Warhol&#8217;s screen prints<\/a>. I tried out about twenty photos. You can find more examples at my <a href=\"https:\/\/twitter.com\/Harri_JK\">twitter account<\/a>.<\/p>\n<p>I dont&#8217;t think I was first to try RGB sorting, but on the other hand I haven really found other examples from the Internet yet. Please send me a message if you know others that have done it before.<\/p>\n<h2>The program<\/h2>\n<p>The program has about 70 lines of code. I will clean it up a bit, streamline the part that finds order of RGB values and publish it here for others to try out.<\/p>\n<h2>What Next?<\/h2>\n<p>Next\u00a0 I will do a function that gives pixels of an image in random order to mimic Netlogo&#8217;s built in patch related collections. An array of pixels (or locations of pixel) will enable me to try other sorting stuff with pixel and it&#8217;s surroundings. I don&#8217;t want to go through pixels in order. It will also make each run a slightly different when change effects to surrounding pixels. Stay tuned for an update!<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sorting RGB values Background I heard of pixel sorting\u00a0and glitch art sometimes last year. It sounded interesting and something a guy with programming background could try. And I did try. Results weren&#8217;t that impressive, but I have to admit I didn&#8217;t do proper research on the subject.\u00a0I used Netlogo\u00a0on my &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6,2,16],"tags":[],"class_list":["post-105","post","type-post","status-publish","format-standard","hentry","category-artwork","category-project","category-re-algorist"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>RGB sorting - Artist and Photographer Harri Kemppainen<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RGB sorting - Artist and Photographer Harri Kemppainen\" \/>\n<meta property=\"og:description\" content=\"Sorting RGB values Background I heard of pixel sorting\u00a0and glitch art sometimes last year. It sounded interesting and something a guy with programming background could try. And I did try. Results weren&#8217;t that impressive, but I have to admit I didn&#8217;t do proper research on the subject.\u00a0I used Netlogo\u00a0on my &hellip;\" \/>\n<meta property=\"og:url\" content=\"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/\" \/>\n<meta property=\"og:site_name\" content=\"Artist and Photographer Harri Kemppainen\" \/>\n<meta property=\"article:published_time\" content=\"2018-03-19T12:33:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-03-19T12:51:16+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/harrikemppainen.com\/en\/wp-content\/uploads\/2018\/03\/Fibonacci_and_ferry-300x300.jpg\" \/>\n<meta name=\"author\" content=\"Harri_JK\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Harri_JK\" \/>\n<meta name=\"twitter:site\" content=\"@Harri_JK\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Harri_JK\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/2018\\\/03\\\/rgb-sorting\\\/#article\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/2018\\\/03\\\/rgb-sorting\\\/\"},\"author\":{\"name\":\"Harri_JK\",\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/#\\\/schema\\\/person\\\/5e5f40ca99c4bbe68de1fc71f13df0bb\"},\"headline\":\"RGB sorting\",\"datePublished\":\"2018-03-19T12:33:29+00:00\",\"dateModified\":\"2018-03-19T12:51:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/2018\\\/03\\\/rgb-sorting\\\/\"},\"wordCount\":460,\"commentCount\":0,\"image\":{\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/2018\\\/03\\\/rgb-sorting\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/Fibonacci_and_ferry-300x300.jpg\",\"articleSection\":[\"artwork\",\"Project\",\"Re-algorist\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/2018\\\/03\\\/rgb-sorting\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/2018\\\/03\\\/rgb-sorting\\\/\",\"url\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/2018\\\/03\\\/rgb-sorting\\\/\",\"name\":\"RGB sorting - Artist and Photographer Harri Kemppainen\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/2018\\\/03\\\/rgb-sorting\\\/#primaryimage\"},\"image\":{\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/2018\\\/03\\\/rgb-sorting\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/Fibonacci_and_ferry-300x300.jpg\",\"datePublished\":\"2018-03-19T12:33:29+00:00\",\"dateModified\":\"2018-03-19T12:51:16+00:00\",\"author\":{\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/#\\\/schema\\\/person\\\/5e5f40ca99c4bbe68de1fc71f13df0bb\"},\"breadcrumb\":{\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/2018\\\/03\\\/rgb-sorting\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/2018\\\/03\\\/rgb-sorting\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/2018\\\/03\\\/rgb-sorting\\\/#primaryimage\",\"url\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/Fibonacci_and_ferry.jpg\",\"contentUrl\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/wp-content\\\/uploads\\\/2018\\\/03\\\/Fibonacci_and_ferry.jpg\",\"width\":1920,\"height\":1920,\"caption\":\"Six RGB sorted frames side by side\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/2018\\\/03\\\/rgb-sorting\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"RGB sorting\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/#website\",\"url\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/\",\"name\":\"Artist and Photographer Harri Kemppainen\",\"description\":\"Stories and background of my photographs and work\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/harrikemppainen.com\\\/en\\\/#\\\/schema\\\/person\\\/5e5f40ca99c4bbe68de1fc71f13df0bb\",\"name\":\"Harri_JK\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e49e7b970a83183eb31ffe40dea9a7bb935767cd2ccca74ff9212d761c2f78a3?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e49e7b970a83183eb31ffe40dea9a7bb935767cd2ccca74ff9212d761c2f78a3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e49e7b970a83183eb31ffe40dea9a7bb935767cd2ccca74ff9212d761c2f78a3?s=96&d=mm&r=g\",\"caption\":\"Harri_JK\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/Harri_JK\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"RGB sorting - Artist and Photographer Harri Kemppainen","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/","og_locale":"en_GB","og_type":"article","og_title":"RGB sorting - Artist and Photographer Harri Kemppainen","og_description":"Sorting RGB values Background I heard of pixel sorting\u00a0and glitch art sometimes last year. It sounded interesting and something a guy with programming background could try. And I did try. Results weren&#8217;t that impressive, but I have to admit I didn&#8217;t do proper research on the subject.\u00a0I used Netlogo\u00a0on my &hellip;","og_url":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/","og_site_name":"Artist and Photographer Harri Kemppainen","article_published_time":"2018-03-19T12:33:29+00:00","article_modified_time":"2018-03-19T12:51:16+00:00","og_image":[{"url":"http:\/\/harrikemppainen.com\/en\/wp-content\/uploads\/2018\/03\/Fibonacci_and_ferry-300x300.jpg","type":"","width":"","height":""}],"author":"Harri_JK","twitter_card":"summary_large_image","twitter_creator":"@Harri_JK","twitter_site":"@Harri_JK","twitter_misc":{"Written by":"Harri_JK","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/#article","isPartOf":{"@id":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/"},"author":{"name":"Harri_JK","@id":"http:\/\/harrikemppainen.com\/en\/#\/schema\/person\/5e5f40ca99c4bbe68de1fc71f13df0bb"},"headline":"RGB sorting","datePublished":"2018-03-19T12:33:29+00:00","dateModified":"2018-03-19T12:51:16+00:00","mainEntityOfPage":{"@id":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/"},"wordCount":460,"commentCount":0,"image":{"@id":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/#primaryimage"},"thumbnailUrl":"http:\/\/harrikemppainen.com\/en\/wp-content\/uploads\/2018\/03\/Fibonacci_and_ferry-300x300.jpg","articleSection":["artwork","Project","Re-algorist"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/","url":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/","name":"RGB sorting - Artist and Photographer Harri Kemppainen","isPartOf":{"@id":"http:\/\/harrikemppainen.com\/en\/#website"},"primaryImageOfPage":{"@id":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/#primaryimage"},"image":{"@id":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/#primaryimage"},"thumbnailUrl":"http:\/\/harrikemppainen.com\/en\/wp-content\/uploads\/2018\/03\/Fibonacci_and_ferry-300x300.jpg","datePublished":"2018-03-19T12:33:29+00:00","dateModified":"2018-03-19T12:51:16+00:00","author":{"@id":"http:\/\/harrikemppainen.com\/en\/#\/schema\/person\/5e5f40ca99c4bbe68de1fc71f13df0bb"},"breadcrumb":{"@id":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/#primaryimage","url":"http:\/\/harrikemppainen.com\/en\/wp-content\/uploads\/2018\/03\/Fibonacci_and_ferry.jpg","contentUrl":"http:\/\/harrikemppainen.com\/en\/wp-content\/uploads\/2018\/03\/Fibonacci_and_ferry.jpg","width":1920,"height":1920,"caption":"Six RGB sorted frames side by side"},{"@type":"BreadcrumbList","@id":"http:\/\/harrikemppainen.com\/en\/2018\/03\/rgb-sorting\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/harrikemppainen.com\/en\/"},{"@type":"ListItem","position":2,"name":"RGB sorting"}]},{"@type":"WebSite","@id":"http:\/\/harrikemppainen.com\/en\/#website","url":"http:\/\/harrikemppainen.com\/en\/","name":"Artist and Photographer Harri Kemppainen","description":"Stories and background of my photographs and work","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/harrikemppainen.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"http:\/\/harrikemppainen.com\/en\/#\/schema\/person\/5e5f40ca99c4bbe68de1fc71f13df0bb","name":"Harri_JK","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/e49e7b970a83183eb31ffe40dea9a7bb935767cd2ccca74ff9212d761c2f78a3?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e49e7b970a83183eb31ffe40dea9a7bb935767cd2ccca74ff9212d761c2f78a3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e49e7b970a83183eb31ffe40dea9a7bb935767cd2ccca74ff9212d761c2f78a3?s=96&d=mm&r=g","caption":"Harri_JK"},"sameAs":["https:\/\/x.com\/Harri_JK"]}]}},"_links":{"self":[{"href":"http:\/\/harrikemppainen.com\/en\/wp-json\/wp\/v2\/posts\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/harrikemppainen.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/harrikemppainen.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/harrikemppainen.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/harrikemppainen.com\/en\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":5,"href":"http:\/\/harrikemppainen.com\/en\/wp-json\/wp\/v2\/posts\/105\/revisions"}],"predecessor-version":[{"id":112,"href":"http:\/\/harrikemppainen.com\/en\/wp-json\/wp\/v2\/posts\/105\/revisions\/112"}],"wp:attachment":[{"href":"http:\/\/harrikemppainen.com\/en\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/harrikemppainen.com\/en\/wp-json\/wp\/v2\/categories?post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/harrikemppainen.com\/en\/wp-json\/wp\/v2\/tags?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}