#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <pipi.h>

double kern[] =
{
       0., -.0625, -.125, -.0625,     0.,
   -.0625,  -.125,  -.25,  -.125, -.0625,
    -.125,   -.25,   3.5,   -.25,  -.125,
   -.0625,  -.125,  -.25,  -.125, -.0625,
       0., -.0625, -.125, -.0625,     0.,
};

int main(int argc, char *argv[])
{
    char *srcname = NULL, *dstname = NULL;
    pipi_image_t *img, *newimg;

    if(argc < 3)
    {
        fprintf(stderr, "%s: too few arguments\n", argv[0]);
        fprintf(stderr, "Usage: %s <src> <dest>\n", argv[0]);
        return EXIT_FAILURE;
    }

    srcname = argv[1];
    dstname = argv[2];

    img = pipi_load(srcname);
    newimg = pipi_convolution(img, 5, 5, kern);
    pipi_free(img);

    pipi_save(newimg, dstname);
    pipi_free(newimg);

    return 0;
}

