What Is Dithering in Computer Graphics?


    Yellow and pink dithering pixel art
    PixelChoice/Shutterstock.com

    You might have come across the word “dithering” when using a graphics or image editing tool. Despite the funny name, dithering plays an important role in ensuring images appear correctly onscreen and in designing retro gaming art.

    How Dithering Works in Computer Graphics

    Dithering is a term used to describe the strategic application of noise to an image. It has traditionally been used to improve the appearance of images where the output is limited to a particular color range.

    For example, a 1-bit image is monochrome and capable of only using a palette of two colors: black and white. Dithering can be employed to create the appearance of multiple shades by varying the distance between dots. You might perceive multiple shades of grey in the image below, but the only colors present are black and white:

    Example of Dithering
    Tim Brookes

    This form of dithering has its roots in the print medium, particularly newspapers and early comic books. Because publishers were limited by the number of colors they could print, dithering was used to expand the perceived range, add texture to an image, and produce better-looking comic strips and photographs.

    As printers became more sophisticated, dithering became a more powerful tool. With more colors to work with, reproducing full-color photographs became more commonplace. Even today some papers still use dithering in their printing process, a phenomenon you can clearly see if you get close enough.

    Dithering Saves Disk Space, Avoids Banding

    With the advent of the world wide web, dithering became a valuable tool for cutting down on file sizes. In the early days of the web, dial-up speeds made data transfer a painful affair.Because a photo can have thousands or millions of colors, limiting which colors can be displayed can dramatically cut the file size.

    By combining available colors in a restricted color space, dithering can convincingly reproduce a detailed image at a fraction of the file size. The image below contains only 256 colors, with the dithering pattern visible in the magnified portion of the image:

    Dithered Image to 256 Colors
    Tim Brookes

    Animated GIFs depended on dithering to cut down on file size. An animated GIF is effectively many images (frames) in a container, displayed one after the other. Dithering can be used to reduce the weight of these frames, though image quality takes a hit.

    Dithering is also used to avoid color banding caused by a restrictive color palette. For example, if your sky has 16 shades of blue but your palette can only display 2, there will be a harsh “band” of color as one shade moves to the next. Dithering can be used to create gradients by varying the distance between these shades, as you can see below:

    Example of dithering blue and purple colors
    PixelChoice/Shutterstock.com

    There are many different algorithms used to dither images, with the most popular being the Floyd-Steinberg algorithm. You can upload your own images and experiment with restricted colors, different algorithms, and see how dithering works for yourself using the Dither it! web application.

    Dithering as a Stylistic Choice

    While modern internet connections have reduced the need for techniques like dithering, the look is often desired for its retro aesthetic. Notable examples of what has become known as “Dither-punk” include Return of the Obra Dinn and Rogue Invader.

    If you’re drawn to the retro look of these games, learning how to enjoy retro games with emulators as well as the legal minefield that accompanies the pastime is a great place to start.

    RELATED: How to Set Up RetroArch, The Ultimate All-In-One Retro Games Emulator





    Source link