source: libpipi/trunk/examples/sharpen.c @ 2902

Last change on this file since 2902 was 2902, checked in by Sam Hocevar, 11 years ago

Support C99 types on Win32 through the same hacks as in libcaca.

File size: 844 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
9double kern[] =
10{
11       0., -.0625, -.125, -.0625,     0.,
12   -.0625,  -.125,  -.25,  -.125, -.0625,
13    -.125,   -.25,   3.5,   -.25,  -.125,
14   -.0625,  -.125,  -.25,  -.125, -.0625,
15       0., -.0625, -.125, -.0625,     0.,
16};
17
18int main(int argc, char *argv[])
19{
20    char *srcname = NULL, *dstname = NULL;
21    pipi_image_t *img, *newimg;
22
23    if(argc < 3)
24    {
25        fprintf(stderr, "%s: too few arguments\n", argv[0]);
26        fprintf(stderr, "Usage: %s <src> <dest>\n", argv[0]);
27        return EXIT_FAILURE;
28    }
29
30    srcname = argv[1];
31    dstname = argv[2];
32
33    img = pipi_load(srcname);
34    newimg = pipi_convolution(img, 5, 5, kern);
35    pipi_free(img);
36
37    pipi_save(newimg, dstname);
38    pipi_free(newimg);
39
40    return 0;
41}
42
Note: See TracBrowser for help on using the repository browser.