- TIFF *in, *out;
- int c;
- extern int optind;
- extern char *optarg;
-
- while ((c = getopt(argc, argv, "c:r:t:bn")) != -1)
- switch (c) {
- case 'b':
- process_by_block = 1;
- break;
-
- case 'c':
- if (streq(optarg, "none"))
- compression = COMPRESSION_NONE;
- else if (streq(optarg, "packbits"))
- compression = COMPRESSION_PACKBITS;
- else if (streq(optarg, "lzw"))
- compression = COMPRESSION_LZW;
- else if (streq(optarg, "jpeg"))
- compression = COMPRESSION_JPEG;
- else if (streq(optarg, "zip"))
- compression = COMPRESSION_DEFLATE;
- else
- usage(-1);
- break;
-
- case 'r':
- rowsperstrip = atoi(optarg);
- break;
-
- case 't':
- rowsperstrip = atoi(optarg);
- break;
-
- case 'n':
- no_alpha = 1;
- break;
-
- case '?':
- usage(0);
- /*NOTREACHED*/
- }
-
- if (argc - optind < 2)
- usage(-1);
-
- out = TIFFOpen(argv[argc-1], "w");
- if (out == NULL)
- return (-2);
-
- for (; optind < argc-1; optind++) {
- in = TIFFOpen(argv[optind], "r");
- if (in != NULL) {
- do {
- if (!tiffcvt(in, out) ||
- !TIFFWriteDirectory(out)) {
- (void) TIFFClose(out);
- return (1);
- }
- } while (TIFFReadDirectory(in));
- (void) TIFFClose(in);
- }
- }
- (void) TIFFClose(out);
- return (0);
+ TIFF *in, *out;
+ int c;
+ extern int optind;
+ extern char *optarg;
+
+ while ((c = getopt(argc, argv, "c:r:t:bn8")) != -1)
+ switch (c) {
+ case 'b':
+ process_by_block = 1;
+ break;
+
+ case 'c':
+ if (streq(optarg, "none"))
+ compression = COMPRESSION_NONE;
+ else if (streq(optarg, "packbits"))
+ compression = COMPRESSION_PACKBITS;
+ else if (streq(optarg, "lzw"))
+ compression = COMPRESSION_LZW;
+ else if (streq(optarg, "jpeg"))
+ compression = COMPRESSION_JPEG;
+ else if (streq(optarg, "zip"))
+ compression = COMPRESSION_DEFLATE;
+ else
+ usage(-1);
+ break;
+
+ case 'r':
+ rowsperstrip = atoi(optarg);
+ break;
+
+ case 't':
+ rowsperstrip = atoi(optarg);
+ break;
+
+ case 'n':
+ no_alpha = 1;
+ break;
+
+ case '8':
+ bigtiff_output = 1;
+ break;
+
+ case '?':
+ usage(0);
+ /*NOTREACHED*/
+ }
+
+ if (argc - optind < 2)
+ usage(-1);
+
+ out = TIFFOpen(argv[argc-1], bigtiff_output?"w8":"w");
+ if (out == NULL)
+ return (-2);
+
+ for (; optind < argc-1; optind++) {
+ in = TIFFOpen(argv[optind], "r");
+ if (in != NULL) {
+ do {
+ if (!tiffcvt(in, out) ||
+ !TIFFWriteDirectory(out)) {
+ (void) TIFFClose(out);
+ (void) TIFFClose(in);
+ return (1);
+ }
+ } while (TIFFReadDirectory(in));
+ (void) TIFFClose(in);
+ }
+ }
+ (void) TIFFClose(out);
+ return (0);