writing TIFF, first setp
This commit is contained in:
38
funcs/t.c
38
funcs/t.c
@@ -14,6 +14,26 @@ int verbosity;
|
||||
|
||||
float global_fvalue;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* nouveau 19 aout 2020, le matin avant la canicule */
|
||||
|
||||
int essai_ecriture_tiff(char *outname)
|
||||
{
|
||||
int foo;
|
||||
FloatImg picz;
|
||||
|
||||
fimg_create(&picz, 800, 600, FIMG_TYPE_RGB);
|
||||
fimg_test_pattern(&picz, 0, 22222);
|
||||
|
||||
foo = fimg_write_as_tiff(&picz, outname, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s got a %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
|
||||
return -7;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* essai de fichiers FITS (astronomie) */
|
||||
int essai_ecriture_fits(char *outname)
|
||||
@@ -25,7 +45,6 @@ fprintf(stderr, "%s is creating the picz\n", __func__);
|
||||
fimg_create(&src, 512, 512, FIMG_TYPE_RGB);
|
||||
fimg_test_pattern(&src, 0, 255.0);
|
||||
|
||||
foo = fimg_save_as_pnm(&src, "foo.pnm", 0);
|
||||
foo = fimg_save_R_as_fits(&src, outname, 0);
|
||||
|
||||
fprintf(stderr, "saving '%s' to fits --> %d\n", outname, foo);
|
||||
@@ -362,7 +381,7 @@ fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo);
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int essai_ecrire_png(char *fname)
|
||||
int essai_ecriture_png(char *fname)
|
||||
{
|
||||
FloatImg fimg;
|
||||
int foo;
|
||||
@@ -371,9 +390,10 @@ fimg_create(&fimg, 800, 600, FIMG_TYPE_RGB);
|
||||
|
||||
fimg_draw_something(&fimg);
|
||||
|
||||
|
||||
foo = fimg_save_as_pnm(&fimg, "quux.pnm", 0);
|
||||
fprintf(stderr, "save as pnm -> %d\n", foo);
|
||||
if (verbosity) {
|
||||
foo = fimg_save_as_pnm(&fimg, "quux.pnm", 0);
|
||||
fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo);
|
||||
}
|
||||
|
||||
foo = fimg_save_as_png(&fimg, fname, 0);
|
||||
fprintf(stderr, "save as png -> %d\n", foo);
|
||||
@@ -381,7 +401,7 @@ fprintf(stderr, "save as png -> %d\n", foo);
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng };
|
||||
enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff };
|
||||
typedef struct {
|
||||
char *name;
|
||||
int Cmd;
|
||||
@@ -395,6 +415,7 @@ Command commands[] = {
|
||||
{ "mire", MIRE },
|
||||
{ "wfits", Wfits },
|
||||
{ "wpng", Wpng },
|
||||
{ "wtiff", Wtiff },
|
||||
{ NULL, 0 }
|
||||
} ;
|
||||
|
||||
@@ -480,7 +501,10 @@ switch(opt) {
|
||||
foo = essai_ecriture_fits(filename);
|
||||
break;
|
||||
case Wpng:
|
||||
foo = essai_ecrire_png(filename);
|
||||
foo = essai_ecriture_png(filename);
|
||||
break;
|
||||
case Wtiff:
|
||||
foo = essai_ecriture_tiff(filename);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s : bad command\n", command);
|
||||
|
||||
Reference in New Issue
Block a user