Quick way to pre-viz color-stripping

by expack3

Let’s say you have an image, like this one:

Grand_Canyon_in_fog.jpg

You’re working on a project where you want to limit the number of colors used in the image. Maybe it’s because you’re on a budget. Maybe it’s because you’re trying to emulate the color palette from a retro game, just without the low resolution or pixellation. Maybe you’re doing it because it’s a challenge.

In any event, let’s pretend you want to change this particular image so it has roughly 32 colors, and have those 32 colors come from an image like this one by artist John Harris:

microdrive2.jpg

With a bit of creativity, you can get an idea of how 32 colors will translate to the target image:

Grand_Canyon_in_fog_colorblend

The question is: how do you quickly transpose 32 colors of your choosing from the second image into the first so you have an idea of where things could go? One way is to create a color table containing all the colors you want from the second image, apply it to a copy of the first, then blur the result and layer it over the original using either Hue or Color blending. Here’s a step-by-step guide on how I’d go about doing it – at least, as far as Photoshop is concerned:

  1. Get the image containing the colors you want open in Photoshop.

Step1.PNG

2. Select Image > Mode > Indexed Color… (now called Color Table in the CC editions)

Step2.PNG

3. The following window will appear:

Step3.PNG

This window will allow us to setup an indexed color palette (aka a color table) for the current image, which we can then save and use later in other images. Before we move on, though, let me give a brief overview on the items in the Palette section:

  • Palette: This drop-down list contains all the different methods Photoshop has for auto-generating the base color table for the current image. It also contains a few pre-built color tables for common use cases, like the default color table used by Windows versions preceding Windows 8/8.1 as well as the ability to create your own color table using up to 256 colors.
  • Colors: This lets you dictate the maximum number of colors Photoshop will use from the image for its color table auto-generation methods. Valid values are from 2-256.
  • Forced: This drop-down list contains dictates whether specific colors, either from a pre-built color table or one you create, must be included in the final color palette.
  • Transparency: This checkbox defines whether transparencies are allowed in the final color table.

4. Make sure Preview is checked so you can see the results of the next step.

5. Set the Palette section as follows:

  • Palette: Local (Perceptual)
  • Colors: 32
  • Forced: None
  • Transparency: Unchecked

Notice how the image very closely resembles its original self…but not quite. Take a look at the platform in the middle-right of the image:

microdrive2_indexed_firstcomp.png

See how the light in the indexed version now looks washed out and – more importantly – the wrong colors compared to the original? Since we want the palette to accurately reflect the important colors in the image, we’ll need to correct this before we continue.

6. Open up the base color table by selecting Custom… from the Palette drop-down.

Step4.PNG

Now the color table window appears. This window allows you to view the current colors and (if the Transparency checkbox from before is checked) transparencies currently in whatever color palette you’re currently editing. (In this case, we’re editing the base color palette.)

Step5.PNG

7. Modify the palette to contain the colors you need.

Picking just the right colors to form a color table is an artform unto itself – so you’ll need to look up the finer points online if you’re curious. (Specifically, try Googling “pixel art tutorial” for some good material.) Otherwise, for this example, just make sure the color table matches the above image. Once you do, the image, when previewed, will look much closer than before:

microdrive2_closeup_comp.jpg

8. Save the color table using the Save… button. (Photoshop color tables are saved as .ACT (Adobe Color Table) files.) Name the table whatever you want.

Now that we have the color table saved, let’s close this reference image and open the image we’ll be using the color table with.

9. Close the image, then open the image you want to use the palette on.

Now let’s bring in the color table we created earlier…

10. Click on Image > Mode > Indexed Color

11. Select Custom from the Palette drop-down menu.

12. From the Color Table window which appears, click on the Load… button and open the color table you saved in Step 8.

13. Click OK. Make sure Preview is checked.

Now that we have the color table loaded, we need to perform some dithering on the image so we won’t get nasty, obvious color-banding in later steps. There are three different types of dithering we can perform in Photoshop:

  • Diffusion: This dithering type uses differing strengths of noise to create transitions between color bands. This is the only setting where you can control the amount of dithering, with valid values being from 1-100.
Grand_Canyon_in_fog_dither25.png

Diffusion with “Amount” set to 25%

Grand_Canyon_in_fog_dither75.png

Diffusion with “Amount” set to 50%

Grand_Canyon_in_fog_dither50.png

Diffusion with “Amount” set to 75%

Grand_Canyon_in_fog_dither100.png

Diffusion with “Amount” set to 100%

  • Noise: This uses a (relatively) consistent noise pattern to dither the image.

Grand_Canyon_in_fog_noise.png

  • Pattern: This uses a (relatively) consistent pattern of shapes to dither the image.

Grand_Canyon_in_fog_pattern.png

The goal is to find a dithering method which, when blurred, will look the closest to the target look (read: best passes the “squinted-eye” test). For our purposes, we’ll be using diffusion dithering as it works the best with our desired set of 32 colors.

14. Configure the settings in Options as such:

  • Matte: None
  • Dither: Diffusion
  • Amount: 75
  • Preserve Exact Colors: Unchecked

15. Click the OK button.

Now we’ve converted our image such that it uses a color table we made instead of the full 8-bit RGB color palette. In order to blend this with the original image, we’ll need to apply some filters with the color table-based image to get rid of the obvious pixellation caused by dithering.

Just one small problem: images in Color Table mode can’t use Photoshop’s filters. Thankfully, it’s trivially-simple to switch back to RGB.

16. Click Image > Mode > RGB Color

17. Apply the Gaussian blur filter with a radius of 1.4px.

Grand_Canyon_in_fog_blurred.jpg

This eliminates the pixellation at the expense of image clarity. In the case of this technique, an unclear image is OK, but too much blur means blending will be impresice, resulting in a poor-quality image. In my experimentation, Gaussian blur with a radius of 1.4px works the best; however, feel free to do your own experimentation and try other methods of blurring to see what works best for your purposes.

Now that we’ve prepared the image for blending, we’re going to copy the image as it is now, revert the changes, then paste into a new layer.

18. Select the entire image, then press Control-C (Command-C on a Mac).

19. Revert the image.

20. Paste the image copied in Step 18 into a new layer. Ensure this layer is above the background layer.

With the blurred image we generated with a color table pasted into a layer, we can now proceed to blend it with the original image. Generally, there are two primary methods to achieve the look of a color table-based image in full color: hue blending and color blending. Here’s what these two methods look like with the image we’re using for this example:

Grand_Canyon_in_fog_hueblend.png

Hue-blended image

Grand_Canyon_in_fog_colorblend.png

Color-blended image

For this example, we’ll use color blending.

21. Change the blending mode on the layer created in Step 20 to Color.

And there we have it! We now have an image which has the look of a dithered image without pixellation from dithering. Here’s a before/after comparison:

 

 

Grand_Canyon_in_fog_beforeAfter.jpg

Advertisements