work on the real PGM export

This commit is contained in:
tth
2022-02-09 23:21:58 +01:00
parent 0da81df892
commit 6ffc08188d
7 changed files with 83 additions and 9 deletions

View File

@@ -43,7 +43,7 @@ puts("\t-v\tincrease verbosity");
puts("\t-o\tname of output file");
puts("\t-g\tconvert to gray level");
puts("");
if (verbosity) { puts(""); fimg_print_version(1); }
if (verbosity) { puts("Xperiment"); fimg_print_version(1); }
exit(0);
}
/* --------------------------------------------------------------------- */
@@ -54,6 +54,7 @@ int opt;
int compte = 0;
int to_gray = 0;
int experiment = 0;
char *output_file = "out.fimg";
FloatImg accu, temp;
int src_loaded = 0;
@@ -61,12 +62,13 @@ float vals[6];
g_width = g_height = 0;
while ((opt = getopt(argc, argv, "gho:v")) != -1) {
while ((opt = getopt(argc, argv, "gho:vx")) != -1) {
switch(opt) {
case 'g': to_gray = 1; break;
case 'h': help(0); break;
case 'o': output_file = optarg; break;
case 'v': verbosity++; break;
case 'x': experiment++; break;
}
}
@@ -101,6 +103,13 @@ for (idx=optind; idx<argc; idx++) {
compte++;
}
/* XXX */
if (experiment) {
}
/* XXX */
if (to_gray) {
foo = fimg_desaturate(&accu, &accu, 0);
if (foo) {
@@ -108,7 +117,8 @@ if (to_gray) {
}
}
// XXX foo = fimg_dump_to_file(&accu, output_file, 0);
/* PLEASE CHECK IF EXPORT TO GRAY MAKE A REAL .pgm FILE */
foo = fimg_export_picture(&accu, output_file, 0);
if (foo) {
fprintf(stderr, "error %d while saving '%s'\n", foo, output_file);