ImageMagick Dithering Tutorial
Sometimes you need the benifits of having varied opacity (such as when creating effects that are overlayed on top of sprites, like fire or smoke), but for technical reasons can't utilize 8-bit transparency. In these cases you can use the information in the alpha channel to dither the image in order to approximate the effect.
Step one: Generate an image with an alpha channel
You can use a ray-tracer, such as POV-Ray, for this. Make sure it utilizes the alpha channel for the transparency information. Using anti-aliasing also can't hurt since there's no colored background for edges to bleed into.
Step two: Decrease the color-depth of the alpha channel
Open your image in an image editor, such as GIMP. Decrease the color-depth of the alpha channel (a.k.a. the mask layer) to 1 bit (2 colors). (You may have to export the alpha channel as a new image, first.)
Step three: Remove all information masked by the alpha channel
Select all pixels in the alpha channel that aren't white. Apply the selection to the other channels and cut these pixels to make them pure blue (RGB 0,0,1).
Step four: Remove the alpha channel and save your image
Delete the alpha channel (the mask), as it's no longer needed. Then save your image.
Example ImageMagick command-line
Here's an example command-line for ImageMagick that can be used in a batch file to automate the process:
set InName="Walls_Arena11.png" set OutName="Walls_Arena11_output.png" convert %InName% ( -channel A -ordered-dither 2x1 ) ( -compose CopyOpacity -composite ) %OutName% convert %OutName% ( -background blue -flatten ) %OutName% convert %OutName% ( -transparent blue ) %OutName%
GH Ditherer is a frontend program I created for ImageMagick. It will perform the above commands on any image file you select.