Lossy Image Formats Part 2: Indexed Color and Digital Watermarking
A few weeks ago, in Lossy Image formats Part 1 I discussed the JPEG image format and the affects of lossy image compression on watermarking.
Part 2, we’ll discuss the other lossy compression that is often used for web images, which is the Indexed Color mode. While many file formats support an Indexed Color mode, these are most often GIF especially since the GIF format requires the image to be in Indexed Color mode. Indexed Color is thought of as a lossy because the color space for most images is reduced from millions of colors to 256 colors or less when indexed. So while a GIF format is not lossy compression, the process of indexing the image color space is.
This sample RGB image contains a digital watermark. By changing the image color mode directly within Photoshop we can see the effect of indexing the color on this image on screen. When I change the image color mode from RGB to Indexed Color (under the Image menu) there are options that will affect how much the color space will be reduced and how closely it will attempt to match the original image color.
NOTE: click on the images for large versions
My goal is twofold: have the image look good, and be able to recover the watermark even after I’ve removed large amounts of color data. To achieve these goals I want the color palette to be adaptive to my local image color space and to be as large as possible, which is a maximum of 256 colors. You can play with the other options to determine the best for your situation.
If we look at the Histogram we can see what has happened to the image’s color space when it goes from RGB to Indexed Color.
Additionally you can see what colors are being used in the indexed image by selecting the Color Table that is now available in the Mode menu.
Some images look pretty good after indexing especially if they have large areas of flat tints, like a PC menu screen shot, and you don’t zoom in too close.
The indexed sample image data is chunky since it only uses 256 colors. What had been a number of blues to make up the sky are now only 2-3 blue shades so the transitions are not very smooth and subtle. You’ll also notice that the entire Photoshop filter menu is now grayed out when an image is in Indexed mode. We are unable to verify the watermark now with the filters grayed out.
Since indexing the image has removed a lot of image data, checking the watermark is important. We need to convert the image from Indexed Color to RGB Color.
Note that we are not using the UNDO command. We want to see how well the remaining image and watermark data still work so we will go back to the Image Menu and change the Mode to RGB Color directly.
With the image converted to RGB, the Photoshop filters are available and we can select Read Watermark to confirm that the watermark is still readable. If we are able to read the watermark, we know that the Indexed Color setting and watermark strength are good for this image. You can undo the conversion to RGB Color and save as GIF to finish the process.
If you plan on saving a lot of images as Indexed GIF you will want to test a number images to determine a good balance of watermark strength and Indexing settings, especially if you have a large variety of image content. Once you’re confident that your watermarks are surviving the indexing conversion, you can create an action script to apply the watermark at the proper setting and use your Indexed Color settings to automate the process.
One last note, converting Index Color to RGB is the same process that the Digimarc Search Service uses. So if make sure your images can still be read as RGB after being converted to Index Color, the Digimarc Search Service can find them.
