Photo editing guides

Choose a small palette for a gradient

·

A gradient exposes the trade-off between sudden color steps and visible dither texture. Use the color-strip example and keep the color target fixed through all three passes.

Reduce Image Colors

Start with four colors

Load the example, choose 4 target colors and select None for dithering. Reduce colors. Each visible source pixel maps to its nearest swatch, and groups of nearby tones form solid bands. The median-cut palette groups the source colors before computing one representative color per group.

Paul Heckbert, Color Image Quantization for Frame Buffer Display

Compare patterns at the same color count

Leave the color count at 4. Run Bayer (4 × 4) and look for a repeated pattern along the boundaries. Run Floyd–Steinberg and compare the texture. Error diffusion passes part of the difference between a pixel and its chosen swatch to pixels that follow it.

ImageMagick color quantization and dithering examples

Keep the mapped colors in the file

Choose the version that reads best at your intended image size. Copy the swatches and save PNG to keep the mapped values. Check the partially transparent strip along the bottom of the example to see how opacity remains independent of the swatches.

W3C Portable Network Graphics specification

Common questions

What does the number of swatches count?

It counts distinct visible RGB triples in the mapped image. Fully transparent pixels are excluded, and pixels with matching RGB can still have different opacity.

Can a transparent PNG keep its soft edges with four colors?

Yes. The tool stores the original opacity at every pixel in the PNG. Edge colors are mapped to the selected palette.

Sources

Put it into practice.

Related guides