dither
Dithering algorithms in Nim
Summary
| Latest Version | 0.2.0 |
|---|---|
| License | Apache-2.0 |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:26 |
Tags
Authors
- Nycto
Installation
nimble install dither
choosenim install dither
git clone https://github.com/Nycto/dither-nim
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| dither | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Dependencies
| Package | Version | Optional |
|---|---|---|
| nim >= 1.6.14", "chroma >= | 0.2.7 | No |
Source
| Repository | https://github.com/Nycto/dither-nim |
|---|---|
| Homepage | https://github.com/Nycto/dither-nim |
| Registry Source | nimble_official |
README
dither-nim
Dithering algorithms implemented in Nim
API
Algorithms
This library supports two primary classifications of algorithms:
- Ordered Dithering: This is a fast dithering algorithm that uses a matrix of predefined values to vary what color is selected.
- Error Diffusion: A slightly slower dithering algorithm that tracks the error incurred when a color is clamped to the palette, then distributes that error to surrounding pixels.
A more detailed list of supported algorithms can be found here:
https://nycto.github.io/dither-nim/dither/types.html#DitherModes
Example
A working example that uses pixie for images and chroma for colors can be seen here:
https://github.com/Nycto/dither-nim/blob/main/example/src/dither_img.nim
A note on concepts
This library uses Nim concepts to control the inputs to its algorithms. This allows it to integrate with arbitrary image, color, and palette libraries -- as long as they implement the interface described by the concepts.