Image Dither
Reduce an image to a limited colour palette with Floyd-Steinberg dithering
/v1/image/dither
curl "https://image.toolkitapi.io/v1/image/dither?url=https://toolkitapi.io/static/samples/sample-image.png&colors=16&format=png"
import httpx
resp = httpx.get(
"https://image.toolkitapi.io/v1/image/dither?url=https://toolkitapi.io/static/samples/sample-image.png&colors=16&format=png",
)
print(resp.json())
const resp = await fetch("https://image.toolkitapi.io/v1/image/dither?url=https://toolkitapi.io/static/samples/sample-image.png&colors=16&format=png", {
});
const data = await resp.json();
console.log(data);
# See curl example
{
"image": "iVBORw0KGgoAAAANSUhEUg...(base64 data)...",
"format": "png",
"colors": 16,
"size": {"width": 1920, "height": 1080}
}
Try It Live
Description
How to Use
1. Provide the source image via the `url` query parameter.
2. Set `colors` to the desired palette size (2–256). Lower values create more dramatic retro effects.
3. Choose `format` as png or gif. GIF is ideal for palette-limited images.
4. The response includes the dithered image and the palette size used.
About This Tool
Use the Image Dither endpoint to reduce an image to a limited colour palette using Floyd-Steinberg dithering and median cut quantization. This creates a stylised, retro look and dramatically reduces file size.
Dithering is essential for GIF preparation (which supports a maximum of 256 colours), creating pixel art aesthetics, and achieving retro-styled visuals. The result maintains the appearance of more colours than are actually present through the dithering pattern.
Why Use This Tool
- GIF preparation — Reduce colour count before GIF encoding
- Pixel art styling — Create retro 8-bit or 16-bit styled images
- File size reduction — Drastically reduce PNG/GIF file sizes with fewer colours
- Artistic effects — Create stylised, posterised visuals
- Print constraints — Prepare images for limited-colour printing (screen printing, risograph)
Frequently Asked Questions
What dithering algorithm is used?
What is the minimum number of colours?
Why does my dithered image look larger than expected?
Start using Image Dither now
Get your free API key and make your first request in under a minute.