This is a command line interface for dithering images using the hitherdither library.
- Install python3
- cd into the folder which this file is stored and create a folder called output
- Use pip to install the requirements from requirements.txt, the command
pip install -r requirements.txt
should work - Now run
python dither.py --help
to show all the options available
-i or --image
Path to the image you wish to dither. If you do not give the absolute path, it must be either within the same folder as this script or a subfolder. This command is the only one that is always required.
Example:
python dither.py -i myimage.png
-d or --dither
The name of the dithering algorithm you wish to use. The default will be bayer dithering.
Available choices:
- bayer or b
- yliluoma or y
- cluster-dot or cd
- floyd-steinberg or fs
- jarvis-judice-ninke or jjn
Example:
python dither.py --image input/mycoolimage.png -d yliluoma
-p or --palette
Name of the palette you wish to dither with. The default palette is geo32. If you want to add more palettes, add them to the palettes.py file as a dictionary of string and rgb tuple pairs, and then go into dither.py and edit the choices of this arg to include the name that you give to your dictionary.
Available choices:
- geo32
- dawnbringer16
- pixelcanvas
- pixelzone
- pxlsspace
Example:
python dither.py -i /home/username/Pictures/myverycoolimage.jpg -p geo32
-t or --threshold
The threshold value you want to use for dithering. The default value is 128. Not all of these dithering algorithms take a threshold value as an argument.
Available choices:
- 2
- 4
- 8
- 16
- 32
- 64
- 128
- 256
- 512
-o or --order
The order value you want to use for dithering. The default value is 8.
Available choices:
- 2
- 4
- 8
- 16
- 32
-e or --exclude
The colours that you do not want to use from whichever palette you are using. The default value is 0, which removes no colours. To see which number corresponds to each palette's colours, look in palettes.py.
Example:
python dither.py -i input/myverycoolimage.png -p geo32 -e 5 8 89
Here the colours 5 and 8 would not be used in dithering, and the input 89 would be ignored, as it isn't a valid colour number.