FloatImg4PythonBinding/tools/mkfimg.c

41 lines
858 B
C
Raw Normal View History

2019-03-03 16:22:55 +01:00
#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]);
2019-07-03 18:51:42 +02:00
fprintf(stderr, "making '%s' %d x %d\n", fname, width, height);
2019-03-03 16:22:55 +01:00
foo = fimg_create(&fimg, width, height, 3);
if (foo) {
fprintf(stderr, "create floatimg -> %d\n", foo);
exit(1);
}
fimg_clear(&fimg);
foo = fimg_dump_to_file(&fimg, fname, 0);
if (foo) {
fprintf(stderr, "dump floatimg -> %d\n", foo);
exit(1);
}
return 0;
}
/* --------------------------------------------------------------------- */