A Photoshop filter for four bit images
![]()
I currently find myself redesigning an HD PVR service with a rather limited graphical specification for the on-screen display. The set-top box can only handle images with four bits per channel, giving a total of 4096 colors to work with. Not quite what one would expect from an HD set-top-box…
A company called Telegraphics have previously provided the 12bits filter for converting images from 8 bits/channel to 4 bits/channel, but they have not updated the filter for Photoshop CS3. The reason for this is probably very low demand for a filter like this. But if someone else out there are stuck with 4 bit images for some reason, you know how useful this filter can be for tuning images. If you are not one of them, you can safely stop reading now.
Adobe have now released a software development kit (Photoshop CS3 SDK) for creating add-ons to Photoshop, so instead of waiting for Telegraphics to upgrade their filter, I made my first plug-in with the CS3 SDK and Apple’s excellent Xcode.
My filter differs from Telegraphics’ filter by rounding off the color values rather than simply discarding the least significant bits. The result is that each color only changes by an average of 4 levels and not more than 8 levels, instead of being changed by an average of 8 levels and up to a total of 16 levels. This produces an image that is more close to the original. The Telegraphics filter changed the pixels in a way that corresponds to enhancing the contrast by applying an S-curve to the image. The formula I used is p=17*floor((p1+8)/17). Telegraphics used p=17*floor(p1/16).
I have called the filter Fourbits to refer to the number of bits per channel rather than something to do with “12 bits” because this kind of images can also be referred to as 16 bit images if they contain an alpha channel.
The filter does not do any dithering since I have yet to see dithering look good in any application. I think it is better to create images that take the limitations of the color space into consideration. That basically means that you should avoid gradients as far as possible. The best results are acheived by creating images that contain only flat colors and textured surfaces. Applying a few percent noice before using fourbits reduces banding at the cost of graininess if you must have gradients.
You can download the filter here: Fourbits.plugin.zip (mac only)
