--- ray/src/px/normtiff.c 2005/06/14 22:23:31 3.9 +++ ray/src/px/normtiff.c 2010/12/04 00:24:43 3.12 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: normtiff.c,v 3.9 2005/06/14 22:23:31 greg Exp $"; +static const char RCSid[] = "$Id: normtiff.c,v 3.12 2010/12/04 00:24:43 greg Exp $"; #endif /* * Tone map SGILOG TIFF or Radiance picture and output 24-bit RGB TIFF @@ -10,6 +10,7 @@ static const char RCSid[] = "$Id: normtiff.c,v 3.9 200 #include #include +#include "platform.h" #include "tiffio.h" #include "color.h" #include "tonemap.h" @@ -137,7 +138,7 @@ main( exit(rval==0 ? 0 : 1); userr: fprintf(stderr, -"Usage: %s [-h][-s][-c][-l][-b][-g gv][-d ld][-u lm][-z][-p xr yr xg yg xb yb xw yw] input.{tif|pic} output.tif\n", +"Usage: %s [-h][-s][-c][-l][-b][-g gv][-d ld][-u lm][-z][-p xr yr xg yg xb yb xw yw] input.{tif|hdr} output.tif\n", argv[0]); exit(1); } @@ -184,6 +185,7 @@ openpicture( /* open/check Radiance picture file */ /* else try opening it */ if ((fp = fopen(fname, "r")) == NULL) return(NULL); + SET_FILE_BINARY(fp); /* allocate struct */ if ((pp = (PICTURE *)malloc(sizeof(PICTURE))) == NULL) return(NULL); /* serious error -- should exit? */ @@ -211,6 +213,7 @@ tmap_picture( /* tone map Radiance picture */ ) { uint16 orient; + double paspect = (pp->rs.rt & YMAJOR) ? pp->pa : 1./pp->pa; int xsiz, ysiz; BYTE *pix; /* read and tone map picture */ @@ -224,7 +227,7 @@ tmap_picture( /* tone map Radiance picture */ orient++; /* put out our image */ if (putimage(orient, (uint32)xsiz, (uint32)ysiz, - 72., 72./pp->pa, 2, pix) != 0) + 72., 72./paspect, 2, pix) != 0) return(-1); /* free data and we're done */ free((void *)pix);