Color Reduction in Photoshop
Disclaimer, disclaimer, disclaimer!
I'm using Photoshop CS4 on a PC. Your menus may look different but the steps will be similar. I'll assume that you know something about how to use Photoshop (this is not a “Learn PS tutorial,” there are plenty of those already). I’m also not going to discuss a lot of the reasons why I am choosing some settings over others in detail – this is a “quick and dirty” guide that only covers the basics.
Pros & Cons of This Method:
Pros
- EASY - the program does the hard work for you.
- Lots of options for fine tuning.
Cons
- You are limited by the file type (more below) - only 256 colors can be used.
- The tool was designed for web optimization, not making the picture look pretty.
Understanding Color and File Types
For sprite-based artwork, JPEGS are worthless since every pixel matters and the JPEG compression affects colors and produces “artifacts” (aka data loss, file corruption, etc). The best formats for images to import into pattern charting software are Portable Network Graphics (PNG) and Bitmap (BMP) because they do not compress colors. PNG is the only option in the tool we’ll be using.
PNG settings
PNG-8 means 8-bit data format and supports up to 256 colors which should be more than enough for most patterns. PNG-24 is similar to JPEGS; it uses compression, can “artifact” and are unsuitable for making pattern charts. We will be using PNG-8 in this guide.
Color Reduction using the "Save for Web & Devices" Tool
This tool will be your best friend. Not only can you resize images this way, it’s the easiest way to limit/reduce colors in an image. Before you open the tool make sure you are finished editing the image (aka no more cropping, painting, color adjustments, etc).
Finding the tool
Code: Select all
File > “Save for Web & Devices…” Or keystroke: Alt+Shift+Ctrl+S
Once you open the tool you will get a new window displaying the image you were working on. The taps on the top left read: Original, Optimized, 2-Up and 4-Up. I usually work in the 2-Up tab (which is what you’ll see in most of the screenshots). The 2-Up tab lets me look at the original on the left and a “working copy” that uses my new settings on the right. The 4-Up tab changes your layout to display the original and three different working copies you can alter.
Important Button/Info Locations
- Presets (top right) – none of the preloaded presets work very well for what we want but we’ll fix that.
- Presets editor (underneath the Presets drop down) – this is where the magic happens. Contains a lot of technical file and color options.
- Color Table (underneath the File Type editor) – this is where fine tuning happens. Each color that is used in the image is displayed here.
- Zoom (on the bottom left above the button that says “device central”)
- # of colors in use: at the bottom right of each working copy (example has 17).
Screen cap of Save for Web & Devices
Making a Preset
- 1) Select “PNG-8 128 Dithered” from the Preset dropdown.
2) Presets Editor: Change the first dropdown to from Selective to Perceptual
3) Presets Editor: Change the second dropdown from Diffusion to No Dither
4) Presets Editor: Uncheck the Transparency box
5) Click the button to the right of the Preset dropdown and save the set up. I named mine “Basic Sprite Set-up”
Editing Colors
The example I’m using has 17 colors including black and white values. You can see all of the used colors in the Color Table. The preset we just made has 128 colors as the default which is over kill for my little sprite. But in this scenario I think 17 is too many colors, I want less! I can reduce the colors three ways:
- 1) Select a preset limit from the Colors dropdown (i.e. 128, 64, 32, 16, 8 etc)
2) Type in my own number of colors in the dropdown
3) Manually remove colors from the Color Table.
Using the first method is the easiest but doesn’t always produce the best results. The second method is mostly a way to “tweak” the first method (i.e. “if 8 colors isn’t enough, maybe 9 will work?”). The last method is one I reserve for images that have lots of shades of the same color. If the image I’m working on has 20 shades of red that’s a problem – there are not that many shades of red floss available and I need to consolidate some of those shades.
Manually Editing Colors
All of this is done in the Color Table.
To Remove a Color
To manually remove a color from the Color Table, click the color to be removed then click the trashcan icon on the bottom right. Once a color is deleted the only way to bring it back to is reset the number of colors in the Presets Editor to what it was before you deleted it.
Sort by Color Usage
Click the menu icon in the color table (top right). Select “Sort by Popularity.” Colors will now be sorted by how often they are used, from most used to least.
Highlighting Color Usage
This is a trick I use to see how/where a color is used in the pattern before manually removing it. Select the color you would like to look at. Click the Transparency icon on the far bottom left of the Color Table. The color you selected will be replaced with a grey-white checked grid which indicates transparency. To Undo the transparency mapping, select the color and click the transparency icon again.
NOTE: Using this tool turns transparency on in the Presets Editor. You may want to turn it back off before you save your file.
Locking a Color
Use this when you want to keep certain shades from being dropped while reducing colors in the Presets Editor.
To lock a color, click the color to be locked then click the padlock icon at the bottom of the Color Table. To unlock a color, select it, then click the padlock icon.
That's it folks! If you have any questions feel free to post them or PM me. I'm thinking of making a video tutorial to go along with this, but we'll see :)