Dithering.
A gimg keeps the image fidelity by dithering when requested colors
are not available in a display driver (e.g., an 8-bit color depth display
driver). To reduce the visual impact due to limited colors, an error adjustment
is required for the image value to be quantified. A gimg uses dithering
for such an error adjustment. Before quantification, a dithering process
compensates an original image value by a negative feedback from a weighted
error, which is calculated from an error image with a special convolution
kernel within a spatial neighborhood. The theory of a dithering process
can be mathematically expressed below:
V_disp = Quantification [V_raw - Err] where V_disp is the output image value to the display; V_raw is the original image value; Err is the weighted quantification errors within the pixel’s neighborhood; Quantification is the quantification table. Given a quantification table and an error matrix, a dithering process is actually an image convolution since quantification is a trivial look-up. A slowdown of the display process due to dithering is a disadvantage, and should be compromised with a proper level of quality control. A gimg has an option -dither that allows a dithering process to have up to four different levels of quality control. The argument of the option -dither can take an integer of 0,, 1, 2, 3, or 4, for non-dithering, level-1 dithering, level-2 dithering, level-3 dithering, and level-4 dithering respectively. A higher level of dithering produces a better image color quality with an expense of a longer processing time. At current implementation, a level-1 dithering process uses a two-pixel convolution kernel; a level-2 dithering process a three-pixel convolution kernel; a level-3 dithering process a four-pixel convolution kernel; and a level-4 dithering process a five-pixel convolution kernel. In addition, a gimg provides an option -dg to select a gain factor to control the negative feedback in a dithering process. The quality of dithering is a function of both the convolution kernel and a proper amount of negative feedback of the error between the requested and the available colors. Dithering at level-1 or level-2 is very fast in comparison with dithering at level-3 or level-4, and in many cases is able to achieve satisfied color quality. A 0.9 gain factor of the option -dg is usually sufficient in many dithering cases. The following examples show the results of non-dithering, as well as dithering at different levels. |
||||
|