# Ditherer

`ditherer` is designed to do one thing: apply a palette to a PNG image to produce an indexed PNG image while preserving the original palette order. It has configurable colorspace-matching and error-diffusion dithering algorithms.

## Build

You'll need a C++11 compiler and `libpng`. 

## Usage
`
Usage:
  ditherer [-?|-h|--help] -i|--in -o|--out -p|--palette [-m|--mask] [-r|--remap] [-c|--colorspace] [-d|--dither] [-f|--factor] [-v|--verbose]

Options, arguments:
  -?, -h, --help

    Display usage information.

  -i, --in <input>

    Input png file

  -o, --out <output>

    Output png file

  -p, --palette <palette>

    Use palette from png file

  -m, --mask <mask>

    Use subset of palette during quantization (comma seperated ints or ranges e.g. '0,1,10,100-255')

  -r, --remap <remap>

    Remap colors in final pass (comma seperated int mappings e.g. '0:160,64:161,66:162,69:163')

  -c, --colorspace <colorspace>

    Use colorspace for palette matching (euclid, cie76, cmc1984, cie94g, cie94t, ciede2000, delta_gray)

  -d, --dither <dither>

    Use dither algorithm (fedoseev, sierralite, sierra2, burkes, atkinson, stucki, jjn, sierra, fs, none)

  -f, --factor <factor>

    Scale dither error by factor

  -v, --verbose

    Show verbose output

