{"id":92,"date":"2012-02-03T21:27:07","date_gmt":"2012-02-03T21:27:07","guid":{"rendered":"http:\/\/www.edais.co.uk\/blog\/?p=92"},"modified":"2012-02-03T22:02:27","modified_gmt":"2012-02-03T22:02:27","slug":"simulating-16-bit-65536-colour-in-photoshop","status":"publish","type":"post","link":"https:\/\/edais.co.uk\/blog\/2012\/02\/03\/simulating-16-bit-65536-colour-in-photoshop\/","title":{"rendered":"Simulating 16-bit (65536) colour in Photoshop"},"content":{"rendered":"<p>A task recently came up which required graphic assets in 16-bit RGB 565 format to work with some old legacy embedded hardware. In case you&#8217;re not familiar with the terminology, 565 basically refers to the number of bits used to store each colour channel; 5 for the Red and Blue channels, and 6 for the Green channel.<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #808080;\">The reason for the unbalanced distribution of bits is that packing a pixel into 15 bits is inefficient since pixels don&#8217;t align on byte boundaries, so an extra bit is added in order to make each pixel byte-aligned. This additional bit is sometimes just wasted (xRGB 1555), sometimes used to provide a basic boolean opacity mask (ARGB 1555) and sometimes added to the green channel (RGB 565) since the photoreceptor cells in the human eye are more sensitive to the yellowish-green part of the spectrum.<\/span><\/p>\n<p>The BMP file format supports 565 mode natively, but having to\u00a0repeatedly\u00a0save the design in order to preview the loss in resolution was a pretty poor workflow, so I came up with a reasonable way to simulate it live \u2013 It&#8217;s not pixel-perfect to what the Bitmap export module produces, but it&#8217;s pretty close.<\/p>\n<p>This technique makes use of the Posterise adjustment layer, which simply clamps input values to a predefined number of levels. The Red and Blue channels are stored in 5-bits each which results in a maximum of 32 distinct values (2<sup>5<\/sup>), whilst the Green channel gets its extra bit which doubles it&#8217;s possible values to 64 (2<sup>6<\/sup>.)<\/p>\n<figure id=\"attachment_93\" aria-describedby=\"caption-attachment-93\" style=\"width: 295px\" class=\"wp-caption alignleft\"><img loading=\"lazy\" class=\"size-full wp-image-93 \" title=\"AdvancedBlending\" src=\"http:\/\/www.edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/AdvancedBlending.gif\" alt=\"Photoshop Advanced Layer Blending\" width=\"295\" height=\"160\" \/><figcaption id=\"caption-attachment-93\" class=\"wp-caption-text\">Locking the first Posterise filter to Red and Blue channels<\/figcaption><\/figure>\n<p>By default the Posterise adjustment layers work across all channels equally, but by tweaking the advanced blending models of the layer it can be targeted on operate only on specific channels.<\/p>\n<p>These controls can be found in the Blending options for the layer.<br \/>\n<br clear=\"both\" \/><br \/>\nThe trick therefore is to use 2 Posterise filters; the first should be set to 32 levels and set to operate on the Red and Blue channels, the second should be set to 64 levels and set to operate only on the Green channel.<\/p>\n<figure id=\"attachment_96\" aria-describedby=\"caption-attachment-96\" style=\"width: 193px\" class=\"wp-caption alignleft\"><img loading=\"lazy\" class=\"size-full wp-image-96\" title=\"PosteriseLayers\" src=\"http:\/\/www.edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/PosteriseLayers.gif\" alt=\"Grouped posterise adjustment layers\" width=\"193\" height=\"106\" \/><figcaption id=\"caption-attachment-96\" class=\"wp-caption-text\">The two posterise filters work in parallel to filter the channels separately<\/figcaption><\/figure>\n<p>Grouping the two adjustment layers together effectively creates a custom togglable effect, which makes it easy to view either the original artwork or the simulated result by switching the visibility of the group.<br \/>\n<br clear=\"both\" \/><br \/>\nHere&#8217;s the results of the preview against a basic test pattern:<\/p>\n<figure id=\"attachment_97\" aria-describedby=\"caption-attachment-97\" style=\"width: 512px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" class=\" wp-image-97 \" title=\"RGB888\" src=\"http:\/\/www.edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/RGB888.png\" alt=\"RGB888\" width=\"512\" height=\"40\" srcset=\"https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/RGB888.png 512w, https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/RGB888-300x23.png 300w, https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/RGB888-500x39.png 500w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><figcaption id=\"caption-attachment-97\" class=\"wp-caption-text\">Original test image<\/figcaption><\/figure>\n<figure id=\"attachment_98\" aria-describedby=\"caption-attachment-98\" style=\"width: 512px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" class=\"size-full wp-image-98\" title=\"555Bitmap\" src=\"http:\/\/www.edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/555Bitmap.png\" alt=\"555Bitmap\" width=\"512\" height=\"40\" srcset=\"https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/555Bitmap.png 512w, https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/555Bitmap-300x23.png 300w, https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/555Bitmap-500x39.png 500w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><figcaption id=\"caption-attachment-98\" class=\"wp-caption-text\">RGB555 Bitmap<\/figcaption><\/figure>\n<figure id=\"attachment_99\" aria-describedby=\"caption-attachment-99\" style=\"width: 512px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" class=\"size-full wp-image-99\" title=\"555Preview\" src=\"http:\/\/www.edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/555Preview.png\" alt=\"555Preview\" width=\"512\" height=\"40\" srcset=\"https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/555Preview.png 512w, https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/555Preview-300x23.png 300w, https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/555Preview-500x39.png 500w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><figcaption id=\"caption-attachment-99\" class=\"wp-caption-text\">RGB555 Preview<\/figcaption><\/figure>\n<figure id=\"attachment_100\" aria-describedby=\"caption-attachment-100\" style=\"width: 512px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" class=\"size-full wp-image-100\" title=\"565Bitmap\" src=\"http:\/\/www.edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/565Bitmap.png\" alt=\"565Bitmap\" width=\"512\" height=\"40\" srcset=\"https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/565Bitmap.png 512w, https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/565Bitmap-300x23.png 300w, https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/565Bitmap-500x39.png 500w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><figcaption id=\"caption-attachment-100\" class=\"wp-caption-text\">RGB565 Bitmap<\/figcaption><\/figure>\n<figure id=\"attachment_101\" aria-describedby=\"caption-attachment-101\" style=\"width: 512px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" class=\"size-full wp-image-101\" title=\"565Preview\" src=\"http:\/\/www.edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/565Preview.png\" alt=\"565Preview\" width=\"512\" height=\"40\" srcset=\"https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/565Preview.png 512w, https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/565Preview-300x23.png 300w, https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/565Preview-500x39.png 500w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><figcaption id=\"caption-attachment-101\" class=\"wp-caption-text\">RGB565 Preview<\/figcaption><\/figure>\n<p>Here&#8217;s a side-by-side comparison of an enlarged segment of the test images which makes it easier to see the results:<\/p>\n<figure id=\"attachment_111\" aria-describedby=\"caption-attachment-111\" style=\"width: 860px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" class=\"size-full wp-image-111\" title=\"SideBySide\" src=\"http:\/\/www.edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/SideBySide.png\" alt=\"Comparison\" width=\"860\" height=\"460\" srcset=\"https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/SideBySide.png 860w, https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/SideBySide-300x160.png 300w, https:\/\/edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/SideBySide-500x267.png 500w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><figcaption id=\"caption-attachment-111\" class=\"wp-caption-text\">Side by side comparison of the different modes<\/figcaption><\/figure>\n<p>The slight difference in the output is most likely down to rounding methods; by the looks of it, the Bitmap output module rounds to the nearest integer where as the Posterise filter rounds up, but it&#8217;s a near enough approximation.<\/p>\n<p>You can grab the <a href=\"http:\/\/www.edais.co.uk\/blog\/wp-content\/uploads\/2012\/02\/16BitPreview.zip\">16-bit preview PSD<\/a>,\u00a0which contains both the RGB555 and RGB565 previews.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A task recently came up which required graphic assets in 16-bit RGB 565 format to work with some old legacy embedded hardware. In case you&#8217;re not familiar with the terminology, 565 basically refers to the number of bits used to store each colour channel; 5 for the Red and Blue channels, and 6 for the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/edais.co.uk\/blog\/2012\/02\/03\/simulating-16-bit-65536-colour-in-photoshop\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Simulating 16-bit (65536) colour in Photoshop&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10,11],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/edais.co.uk\/blog\/wp-json\/wp\/v2\/posts\/92"}],"collection":[{"href":"https:\/\/edais.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/edais.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/edais.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/edais.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=92"}],"version-history":[{"count":2,"href":"https:\/\/edais.co.uk\/blog\/wp-json\/wp\/v2\/posts\/92\/revisions"}],"predecessor-version":[{"id":168,"href":"https:\/\/edais.co.uk\/blog\/wp-json\/wp\/v2\/posts\/92\/revisions\/168"}],"wp:attachment":[{"href":"https:\/\/edais.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=92"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/edais.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=92"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/edais.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=92"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}