1
1
# Dither - Color Quantization and Dithering
2
2
3
3
This is a small program dedicated to reducing the number of colors in an
4
- image. It operates with files in binary PPM format ([ Portable PixMap ] [ ppm ] ),
5
- and features automatic palette generation (using a median-cut algorithm) and
6
- dithering implemented with the Floyd-Steinberg method.
4
+ image. It operates with files in PNG or binary PPM format ([ Portable
5
+ PixMap ] [ ppm ] ), and features automatic palette generation (using a median-cut
6
+ algorithm) and dithering implemented with the Floyd-Steinberg method.
7
7
8
8
## Installing
9
9
10
- #### On macOS with [ Homebrew] [ brew ]
10
+ #### On macOS with [ Homebrew] [ brw ]
11
11
12
12
$ brew install tessarin/core/dither
13
13
14
14
#### Manual Installation
15
15
16
- Running ` make ` will compile the program and generate the documentation
17
- (requires Perl). To install, move the executable and manual file to the
18
- appropriate directories.
16
+ First, install [ ` libpng ` ] [ lpg ] . Running ` make ` will then compile the program
17
+ and generate the documentation (requires Perl). To install, move the
18
+ executable and manual files to appropriate directories in your system .
19
19
20
20
$ make
21
21
$ mv dither ~/bin
22
22
$ mv dither.1 ~/man/man1
23
23
24
- Individual targets can also be specified for only compiling or generating the
25
- manual page:
24
+ Individual targets can also be specified to only compile the program or to
25
+ generate the manual page:
26
26
27
27
$ make dither
28
28
$ make doc
@@ -47,6 +47,32 @@ processing an image. Other possible palettes include:
47
47
Dithering on the final image can be disabled and the program can also be used
48
48
just to generate a palette.
49
49
50
+ ## Samples
51
+
52
+ #### Automatic Palette
53
+
54
+ $ dither -p auto.32 bird-original.png bird-auto.32.png
55
+
56
+ ![ original bird] ( samples/bird-original.png )
57
+ ![ generated bird] ( samples/bird-auto.32.png )
58
+
59
+ #### 1-bit Black & White
60
+
61
+ $ dither -p bw flower-original.png flower-bw.png
62
+
63
+ ![ original flower] ( samples/flower-original.png )
64
+ ![ generated flower] ( samples/flower-bw.png )
65
+
66
+ #### 50% Gray Test
67
+
68
+ Generates a perfect checkerboard pattern.
69
+
70
+ $ dither -p bw gray-original.png gray-dithered.png
71
+
72
+ ![ original gray] ( samples/gray-original.png )
73
+ ![ dithered gray] ( samples/gray-dithered.png )
74
+
50
75
[ ppm ] : https://en.wikipedia.org/wiki/Netpbm_format
51
- [ brew ] : https://brew.sh
76
+ [ brw ] : https://brew.sh
77
+ [ lpg ] : http://www.libpng.org/pub/png/libpng.html
52
78
[ man ] : dither.pod
0 commit comments