Color quantization/C: Difference between revisions
Content added Content deleted
(Fixed bug in C code) |
m (Replace <lang> by <syntaxhighlight> block so it's better formatted) |
||
Line 1: | Line 1: | ||
[[file:Quantum_frog_dithered.png|200px|thumb]]This is a complete program that takes a PPM P6 image and a number, then writes out the image reduced to the number of colors to out.ppm. There is optional dithering, too, which doesn't make a whole lot of difference with say 64 colors or more. And with low colors, the quantization did such a good job of picking average colors that it actually hurts the dithering process. |
[[file:Quantum_frog_dithered.png|200px|thumb]]This is a complete program that takes a PPM P6 image and a number, then writes out the image reduced to the number of colors to out.ppm. There is optional dithering, too, which doesn't make a whole lot of difference with say 64 colors or more. And with low colors, the quantization did such a good job of picking average colors that it actually hurts the dithering process. |
||
< |
<syntaxhighlight lang="c">#include <stdio.h> |
||
#include <stdlib.h> |
#include <stdlib.h> |
||
#include <fcntl.h> |
#include <fcntl.h> |
||
Line 366: | Line 366: | ||
return 0; |
return 0; |
||
}</ |
}</syntaxhighlight> |