export planes as 16 bits PGM, second try
This commit is contained in:
parent
c17132e969
commit
b98c398c3c
@ -4,7 +4,7 @@
|
||||
* http://la.buvette.org/photos/cumul
|
||||
*/
|
||||
|
||||
#define FIMG_VERSION 170
|
||||
#define FIMG_VERSION 171
|
||||
|
||||
/*
|
||||
* in memory descriptor
|
||||
@ -22,7 +22,7 @@ typedef struct {
|
||||
} FloatImg;
|
||||
|
||||
/*
|
||||
* fimg file header
|
||||
* fimg file header (short version)
|
||||
*/
|
||||
typedef struct {
|
||||
char magic[8];
|
||||
|
0
lib/README.md
Normal file
0
lib/README.md
Normal file
@ -232,7 +232,7 @@ if (NULL==(fp=fopen(fname, "w"))) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
fprintf(fp, "P2\n%d\n%d\n65535\n\n", psrc->width, psrc->height);
|
||||
fprintf(fp, "P2\n%d %d\n65535\n\n", psrc->width, psrc->height);
|
||||
area = psrc->width * psrc->height;
|
||||
maxval = fimg_get_plane_maxvalue(psrc, plane);
|
||||
fk = maxval / 65535.0;
|
||||
@ -250,7 +250,7 @@ for (idx=0; idx<area; idx++) {
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* nouveau 10 fevrier 2022 */
|
||||
|
12
lib/t.c
12
lib/t.c
@ -28,8 +28,20 @@ if (foo) {
|
||||
return -6;
|
||||
}
|
||||
foo = fimg_save_plane_as_pgm(&image, "red.pgm", 'r');
|
||||
if (foo) {
|
||||
fprintf(stderr, "err save red %d\n", foo);
|
||||
return -6;
|
||||
}
|
||||
foo = fimg_save_plane_as_pgm(&image, "green.pgm", 'g');
|
||||
if (foo) {
|
||||
fprintf(stderr, "err save green %d\n", foo);
|
||||
return -6;
|
||||
}
|
||||
foo = fimg_save_plane_as_pgm(&image, "blue.pgm", 'b');
|
||||
if (foo) {
|
||||
fprintf(stderr, "err save blue %d\n", foo);
|
||||
return -6;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user