ImageDithering
Code implementation for 4 image dithering techniques: Threshold, Error diffusion, Ordered and Pattern (Halftone) Dithering methods.
Install / Use
/learn @Mahmoud-Ibrahim-750/ImageDitheringREADME
Image Dithering
Image Dithering is a Python package that provides a simple implementation of four popular dithering algorithms, Threshold, Error diffusion (Floyd-Stienberg), Ordered and Pattern (Halftone) Dithering techniques. Dithering is a technique used in image processing to reduce the number of colors in an image while still maintaining the visual appearance of the original image. The code is written in Python and uses the NumPy and Pillow libraries.
Installation
To install Image Dithering, simply clone this repository to your desktop. It's recommended to use PyCharm IDE.
Usage
Here's an example of how to use Image Dithering to convert an image to a 2-bit color palette using the threshold algorithm. Where input.jpg is the provided image as an input, output_threshold.jpg is the name of the output image generated by the algorithm, and 128 is the threshold value:
threshold_dithering('input.jpg', 'output_threshold.jpg', 128)
Contributing
I would love to have some contributions, So if you would like to contribute to Image Dithering, please follow these steps:
- Fork the repository
- Create a new branch
- Make your changes and commit them
- Push to the branch
- Create a new pull request
Examples
Here is an example of an image before and after dithering:
- Original image:

- Threshold algorithm image

- Error Diffusion algorithm

- Ordered Dithering algorithm

- Pattern Dithering algorithm (with 4 shades of gray)

License
This code is licensed under the MIT License. See the LICENSE file for details.
Related Skills
node-connect
353.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.6kCreate 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
353.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
353.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
