10 #define NO_DECLARE_MALLOC
18 #define USE_PROTOTYPES 1
24 #define SETFIELD(tif, fieldname, arg) TIFFSetField(tif,fieldname,arg)
33 void get_tiff_scanline();
57 long int rows_per_strip;
59 char *outfname = NULL, *infname = NULL;
64 error(
"tiff_sample and rle_pixel not same size");
66 if (
scanargs( argc
, argv
, "% Cc%- f%- o!-outfile.tiff!s infile.rle%s\n(\
67 \tConvert URT image to 24-bit TIFF image.\n\
68 \t-c\tUse LZW compression (default)\n\
69 \t-C\tUse no compression\n\
70 \t-f\tDon't flip image top to bottom\n\
71 \t-o outfile.tiff is required)",
72 &cflag
, &
flip, &i
, &outfname
, &infname
) == 0 )
77 else if ( cflag == 2 )
93 if (
RGBscanline == NULL) error(
"can't allocate RGB scanline");
94 tif = TIFFOpen(outfname,
"w");
95 if (!
tif) error(
"tiffopen ret null");
100 SETFIELD(tif,TIFFTAG_IMAGEWIDTH, (
unsigned long)(in_hdr.xmax + 1));
101 SETFIELD(tif,TIFFTAG_IMAGELENGTH,
102 (
unsigned long)(in_hdr.ymax - in_hdr.ymin + 1));
106 if (rows_per_strip < 1) rows_per_strip = 1L;
107 SETFIELD(
tif, TIFFTAG_ROWSPERSTRIP, rows_per_strip);
143 if ( scan == 0 ) error(
"can't allocate scan");
151 error(
"can't allocate a scan buffer");
154 for (j=0; j < 3; j++) {
156 if (scan[j] == NULL) error(
"can't allocate current scanline");
162 for (j=0; j < 3; j++) {
164 if (scan[j] == NULL) error(
"can't allocate current scanline");
169 for (j=0; j < 3; j++) {
171 if (scan[j] == NULL) error(
"can't allocate current scanline");
183 get_tiff_scanline( buf, row )
208 fprintf(stderr,
"Usage:\n");
209 fprintf(stderr,
"\trletotiff [options] infile outfile\n");
210 fprintf(stderr,
"options:\n");
211 fprintf(stderr,
"\t-c lzw or -c none (compression, default lzw)\n");
212 fprintf(stderr,
"\t-v (vertical flip, default not)\n");
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
static rle_pixel ** scan_green
static tiff_sample * RGBscanline
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
char * cmd_name(char **argv)
void main(int argc, char **argv)
static unsigned short compression
int rle_getrow(rle_hdr *the_hdr, scanline)
int scanargs(int argc, char **argv, const char *format,...)
static rle_pixel ** scan_blue
#define SETFIELD(tif, fieldname, arg)
static rle_pixel ** scan_red
unsigned char tiff_sample
void rle_get_setup_ok(rle_hdr *the_hdr, const char *prog_name, const char *file_name)
#define RLE_CLR_BIT(glob, bit)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)