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
+13 -5
View File
@@ -83,12 +83,13 @@ return 0;
}
/* ---------------------------------------------------------------- */
int essai_2gray(FloatImg *picz, char *outname)
int essai_2gray(FloatImg *picz, char *basename)
{
int foo;
FloatImg gray;
char outname[200];
fprintf(stderr, ">>> %s ( %p '%s' )\n", __func__, picz, outname);
fprintf(stderr, ">>> %s ( %p '%s' )\n", __func__, picz, basename);
foo = fimg_create(&gray, picz->width, picz->height, FIMG_TYPE_GRAY);
if (foo) {
@@ -101,9 +102,16 @@ if (foo) {
exit(1);
}
strcpy(outname,basename); strcat(outname, ".pnm");
foo = fimg_save_as_pnm(&gray, outname, 0);
if (foo) {
fprintf(stderr, "%s : err %d on save_as_pnm\n", __func__, foo);
fprintf(stderr, "%s : err %d on save_as_PNM\n", __func__, foo);
exit(1);
}
strcpy(outname,basename); strcat(outname, ".pgm");
foo = fimg_save_as_pgm(&gray, outname, 0);
if (foo) {
fprintf(stderr, "%s : err %d on save_as_PGM\n", __func__, foo);
exit(1);
}
@@ -261,8 +269,8 @@ if (verbosity) {
fimg_print_sizeof();
}
foo = essai_contraste("quux.fimg");
fprintf(stderr, "retour essai contraste -> %d\n", foo);
foo = essai_2gray(NULL, "quux");
fprintf(stderr, "retour essai -> %d\n", foo);
// foo = essai_clone_et_copy(0);
// fprintf(stderr, "retour essai clone'n'copy -> %d\n", foo);