AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

1993.11.18 16:36 "ras2tiff improvements", by Achille Petrilli

Hi,

I've slightly modified ras2tiff to allow to change the meaning of 0 bits in bilevel images (it was min-is-black, I added a "-white" flag). I also added a "-xres" and a "-yres" options to generate a tiff file with a given resolution. By default (no options or only old options) the generated file is the same as the old version of ras2tiff.

I compiled the modified ras2tiff on a Sun using the ANSI C compiler from Sun. I believe that should just compile everywhere.

Cheers,

Achille Petrilli

Here are the diffs between my version and the 3.2+patch ras2tiff.c version as available on sgi.com:

----- cut here -----
47,49d46
< int minis = PHOTOMETRIC_MINISBLACK;
< float xres = -1.;
< float yres = -1.;
77,90d73
<               if (streq(argv[0], "-white")) {
<                       minis = PHOTOMETRIC_MINISWHITE;
<                       continue;
<               }
<               if (streq(argv[0], "-xres")) {
<                       argc--, argv++;
<                       xres = (float)atoi(argv[0]);
<                       continue;
<               }
<               if (streq(argv[0], "-yres")) {
<                       argc--, argv++;
<                       yres = (float)atoi(argv[0]);
<                       continue;
<               }
98,104d80
<       if (xres <= 0. || yres <= 0.)
<       {
<               if (xres <= 0. && yres > 0.)
<                       xres = yres;
<               else if (xres > 0. && yres <= 0.)
<                       yres = xres;
<       }
127,130d102
<       if (xres > 0.) {
<               TIFFSetField(out, TIFFTAG_XRESOLUTION, xres);
<               TIFFSetField(out, TIFFTAG_YRESOLUTION, yres);
<       }
179c151
<                   PHOTOMETRIC_RGB : minis);
---
>                   PHOTOMETRIC_RGB : PHOTOMETRIC_MINISBLACK);
218,223d189
<       fprintf(stderr,
<           " -white\t\t0 is white (min-is-white), bilevel images\n");
<       fprintf(stderr,
<           " -xres\t\tx resolution (dots/inch), default unspecified\n");
<       fprintf(stderr,
<           " -yres\t\ty resolution (dots/inch), default unspecified\n");