Skip to content

Latest commit

 

History

History
20 lines (10 loc) · 1.06 KB

README.md

File metadata and controls

20 lines (10 loc) · 1.06 KB

Ordered dithering

This repository contains an implementation of ordered dithering that works with custom palettes.

Two Python 3 scripts are included. The first is generate_lut.py, which generates a lookup table for a given palette. The second is dither.py, which uses a previously generated lookup table and dithers a given image using it. The scripts require NumPy and Pillow to be installed.

The actual dithering algorithm is very fast when it uses a pre-built lookup table. It handles each pixel individually, and therefore the algorithm is also very easy to implement in a shader to achieve real-time dithering.

Examples

Here are some example images that have been dithered using this algorithm. All examples use the Commodore 64 palette (https://lospec.com/palette-list/commodore64).

Commodore 64 palette

Parrot Dithered Parrot

Lenna Dithered Lenna

RGB Dithered RGB