Contents

Purpose

This macro takes an 8 bit greyscale or a 24 bit RGB image and performs dithering using one of the methods supported.
Dithering is a type of half tone thresholding where greyscale (or RGB channel) intensity is converted into a local density of binary pixels. This is ideal for rendering images in devices with a binary output such as printers (greyscale) or with a small number of colours (colour dithering).

In the case of 24 bit RGB images the macro lets you either apply dithering to the greyscale version of the image or to each of the RGB channels (colour dithering).

Installation

Copy the source code below and save it into a file called "Dithering_.txt" somewhere in the /Plugins folder. Restarting Fiji or ImageJ will show a new command called "Dithering".

Available methods

The following methods have been implemented (there are several more): Floyd-Steinberg, Atkinson, Jarvis-Judice-Ninke, Stucki, Bayer_2x2, Bayer_4x4, Bayer_8x8, Clustered_4x4 and Random.
Scaling dithered images by certain factors introduce numerous artifacts, so it is essential to apply dithering after image resizing.
Dithering results are best rendered when the image is displayed or printed using small pixels.

The following images have been magnified by a factor of 2 to show the individual pixels.