Ditherpy
Python dithering library that implements colour-correct Atkinson dithering.
Install / Use
/learn @obrhubr/DitherpyREADME
Ditherpy
ditherpy is a simple library for dithering. It implements both linearising the input image and a perception-corrected distance function. See this Stackoverflow thread for details on colour-correction.
You can provide a custom palette and toggle the colour-correction measures.
See obrhubr.org/dithering-in-colour for more details.
Usage
Install pip3 install numpy Pillow tqdm.
Run python3 demo.py to generate two demo images, one of Dürer's "Young Hare" and a gradient.



The first image is the original, the second the linearised and third the non-linearised dithered image.
Usage as a library
Import from ditherpy import Dither.
- choose the colour space to use
colour_spacefrom"srgb"|"lin-srgb"|"oklab". - choose the dithering diffusion matrix
mode="Atkinson"|"FloydSteinberg". - toggle a dynamic palette based on the image's colours
dynamic_palette=True|False.
Load your image with Pillow into a numpy array, choose a palette and then run:
image = Image.open("input.jpg").convert("RGB")
# Choose a palette
# Array of arrays of RGB values
palette = np.array([[0, 0, 0], [255, 255, 255]])
dithered = Dither(options...).dither(image, palette)
Related Skills
node-connect
354.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
