Last change
on this file since 2902 was
2902,
checked in by Sam Hocevar, 12 years ago
|
Support C99 types on Win32 through the same hacks as in libcaca.
|
File size:
976 bytes
|
Line | |
---|
1 | #include "config.h" |
---|
2 | |
---|
3 | #include <stdio.h> |
---|
4 | #include <stdlib.h> |
---|
5 | #include <string.h> |
---|
6 | |
---|
7 | #include <pipi.h> |
---|
8 | |
---|
9 | int main(int argc, char *argv[]) |
---|
10 | { |
---|
11 | char *srcname = NULL, *dstname = NULL; |
---|
12 | pipi_image_t *img, *newimg, *tmp; |
---|
13 | pipi_histogram_t* histogram; |
---|
14 | int ret = 0; |
---|
15 | if(argc < 2) |
---|
16 | { |
---|
17 | fprintf(stderr, "%s: too few arguments\n", argv[0]); |
---|
18 | fprintf(stderr, "Usage: %s <src> <dest>\n", argv[0]); |
---|
19 | return EXIT_FAILURE; |
---|
20 | } |
---|
21 | |
---|
22 | srcname = argv[1]; |
---|
23 | dstname = argv[2]; |
---|
24 | |
---|
25 | img = pipi_load(srcname); |
---|
26 | |
---|
27 | if(!img) { |
---|
28 | fprintf(stderr, "Can't open %s for reading\n", srcname); |
---|
29 | } |
---|
30 | |
---|
31 | newimg = pipi_copy(img); |
---|
32 | pipi_free(img); |
---|
33 | |
---|
34 | |
---|
35 | tmp = pipi_copy(newimg); |
---|
36 | |
---|
37 | histogram = pipi_new_histogram(); |
---|
38 | pipi_get_image_histogram(tmp, histogram, PIPI_COLOR_R|PIPI_COLOR_G|PIPI_COLOR_B); |
---|
39 | |
---|
40 | |
---|
41 | pipi_render_histogram(tmp, histogram, PIPI_COLOR_R|PIPI_COLOR_G|PIPI_COLOR_B); |
---|
42 | |
---|
43 | pipi_save(tmp, dstname); |
---|
44 | pipi_free(newimg); |
---|
45 | |
---|
46 | return ret; |
---|
47 | } |
---|
48 | |
---|
Note: See
TracBrowser
for help on using the repository browser.