source: libpipi/trunk/examples/img2rubik.c @ 2736

Last change on this file since 2736 was 2736, checked in by Sam Hocevar, 14 years ago
  • Move the palette reduction algorithm into pipi_reduce().
File size: 609 bytes
Line 
1#include "config.h"
2#include "common.h"
3
4#include <stdio.h>
5#include <stdlib.h>
6#include <string.h>
7#include <math.h>
8
9#include <pipi.h>
10
11int main(int argc, char *argv[])
12{
13    static double const mypal[] =
14    {
15        0.900, 0.001, 0.001, /* red */
16        0.001, 0.800, 0.001, /* green */
17        0.005, 0.001, 0.500, /* blue */
18        0.900, 0.900, 0.900, /* white */
19        0.900, 0.900, 0.001, /* yellow */
20        0.800, 0.400, 0.001, /* orange */
21    };
22
23    pipi_image_t *src = pipi_load(argv[1]);
24    pipi_image_t *dst = pipi_reduce(src, 6, mypal);
25    pipi_save(dst, argv[2]);
26
27    return 0;
28}
29
Note: See TracBrowser for help on using the repository browser.