--- ray/src/px/aedimage.c 1990/11/07 13:10:27 1.8 +++ ray/src/px/aedimage.c 1991/12/19 14:51:44 2.2 @@ -97,8 +97,8 @@ FILE *fin; extern long ftell(); long scanpos[NROWS]; -extern double atof(); double exposure = 1.0; +int wrong_fmt = 0; main(argc, argv) @@ -140,9 +140,11 @@ char *argv[]; quitmsg(errmsg); } /* get header */ - getheader(fin, checkhead); + getheader(fin, checkhead, NULL); + if (wrong_fmt) + quitmsg("input must be a Radiance picture"); /* get picture dimensions */ - if (fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR)) + if (fgetresolu(&xmax, &ymax, fin) < 0) quitmsg("bad picture size"); if (xmax > NCOLS || ymax > NROWS) quitmsg("resolution mismatch"); @@ -169,8 +171,14 @@ userr: checkhead(line) /* deal with line from header */ char *line; { + char fmt[32]; + if (isexpos(line)) exposure *= exposval(line); + else if (isformat(line)) { + formatval(fmt, line); + wrong_fmt = strcmp(fmt, COLRFMT); + } } @@ -315,7 +323,7 @@ loopcom() /* print pixel values interactively */ break; case 'l': case 'L': - printf("%-3gL", bright(cval)*683.0/exposure); + printf("%-3gL", luminance(cval)/exposure); break; case 'c': case 'C':