FloatImg4PythonBinding/tools/mkfimg.c
2019-03-03 16:22:55 +01:00

42 lines
903 B
C

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "../floatimg.h"
/* --------------------------------------------------------------------- */
int main(int argc, char *argv[])
{
int foo;
int width, height;
char *fname;
FloatImg fimg;
if (4 != argc) {
fimg_print_version(1);
fprintf(stderr, "Usage:\n\t%s quux.fimg width height\n", argv[0]);
exit(1);
}
fname = argv[1];
width = atoi(argv[2]); height = atoi(argv[3]);
fprintf(stderr, "making %s %d x %d\n", fname, width, height);
foo = fimg_create(&fimg, width, height, 3);
if (foo) {
fprintf(stderr, "create floatimg -> %d\n", foo);
exit(1);
}
fimg_describe(&fimg, "just a black flimg");
fimg_clear(&fimg);
foo = fimg_dump_to_file(&fimg, fname, 0);
if (foo) {
fprintf(stderr, "dump floatimg -> %d\n", foo);
exit(1);
}
return 0;
}
/* --------------------------------------------------------------------- */