summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormiguel <medalist@sapo.pt>2020-12-25 05:09:00 +0000
committermiguel <medalist@sapo.pt>2020-12-25 05:09:00 +0000
commitceead1d923858107f98cda041f9e34bd54febc4b (patch)
tree9885542f4cede0d4e59bc6262898f97660fd1f14
parent97049062b9d1efa7b00d7a13bcf97365b57c937b (diff)
downloadlibtiff-git-ceead1d923858107f98cda041f9e34bd54febc4b.tar.gz
tiff tools: made display of compression methods and their parameters conditional on their actual availability
-rw-r--r--tools/fax2tiff.c14
-rw-r--r--tools/pal2rgb.c27
-rw-r--r--tools/ppm2tiff.c36
-rw-r--r--tools/raw2tiff.c35
-rw-r--r--tools/rgb2ycbcr.c48
-rw-r--r--tools/tiff2bw.c28
-rw-r--r--tools/tiff2pdf.c24
-rw-r--r--tools/tiff2rgba.c52
-rw-r--r--tools/tiffcp.c82
-rw-r--r--tools/tiffcrop.c85
-rw-r--r--tools/tiffdither.c56
-rw-r--r--tools/tiffmedian.c41
12 files changed, 352 insertions, 176 deletions
diff --git a/tools/fax2tiff.c b/tools/fax2tiff.c
index eecb41e3..6b93f9ef 100644
--- a/tools/fax2tiff.c
+++ b/tools/fax2tiff.c
@@ -57,6 +57,10 @@
#define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
+#ifndef HAVE_GETOPT
+extern int getopt(int argc, char * const argv[], const char *optstring);
+#endif
+
TIFF *faxTIFF;
char *rowbuf;
char *refbuf;
@@ -428,7 +432,7 @@ copyFaxFile(TIFF* tifin, TIFF* tifout)
return (row);
}
-const char* stuff[] = {
+const char* usage_info[] = {
"usage: fax2tiff [options] input.raw...",
"where options are:",
" -3 input data is G3-encoded [default]",
@@ -446,6 +450,7 @@ const char* stuff[] = {
" -X # input data has # width [default is 1728]",
"",
" -o out.tif write output to out.tif",
+#ifdef CCITT_SUPPORT
" -7 generate G3-encoded output [default]",
" -8 generate G4-encoded output",
" -u generate uncompressed output (G3 or G4)",
@@ -453,6 +458,7 @@ const char* stuff[] = {
" -6 generate 2D-encoded output (G3 only) [default]",
" -p generate not EOL-aligned output (G3 only)",
" -a generate EOL-aligned output (G3 only) [default]",
+#endif
" -c generate \"classic\" TIFF format",
" -f generate TIFF Class F (TIFF/F) format [default]",
" -m output fill order is MSB2LSB",
@@ -460,7 +466,9 @@ const char* stuff[] = {
" -r # make each strip have no more than # rows",
" -s stretch image by duplicating scanlines",
" -v print information about conversion work",
+#ifdef LZW_SUPPORT
" -z generate LZW compressed output",
+#endif
NULL
};
@@ -471,8 +479,8 @@ usage(int code)
FILE * out = (code == EXIT_SUCCESS) ? stdout : stderr;
fprintf(out, "%s\n\n", TIFFGetVersion());
- for (i = 0; stuff[i] != NULL; i++)
- fprintf(out, "%s\n", stuff[i]);
+ for (i = 0; usage_info[i] != NULL; i++)
+ fprintf(out, "%s\n", usage_info[i]);
exit(code);
}
diff --git a/tools/pal2rgb.c b/tools/pal2rgb.c
index bf95cb37..51830779 100644
--- a/tools/pal2rgb.c
+++ b/tools/pal2rgb.c
@@ -46,6 +46,10 @@
#define EXIT_FAILURE 1
#endif
+#ifndef HAVE_GETOPT
+extern int getopt(int argc, char * const argv[], const char *optstring);
+#endif
+
#define streq(a,b) (strcmp(a,b) == 0)
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
@@ -436,7 +440,7 @@ cpTags(TIFF* in, TIFF* out)
}
#undef NTAGS
-const char* stuff[] = {
+const char* usage_info[] = {
"usage: pal2rgb [options] input.tif output.tif",
"where options are:",
" -p contig pack samples contiguously (e.g. RGBRGB...)",
@@ -445,14 +449,23 @@ const char* stuff[] = {
" -C 8 assume 8-bit colormap values (instead of 16-bit)",
" -C 16 assume 16-bit colormap values",
"",
+#ifdef LZW_SUPPORT
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
+/* " LZW options:", */
+" # set predictor value",
+" For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+#endif
+#ifdef ZIP_SUPPORT
" -c zip[:opts] compress output with deflate encoding",
+/* " Deflate (ZIP) options:", */
+" # set predictor value",
+#endif
+#ifdef PACKBITS_SUPPORT
" -c packbits compress output with packbits encoding",
+#endif
+#if defined(LZW_SUPPORT) || defined(ZIP_SUPPORT) || defined(PACKBITS_SUPPORT)
" -c none use no compression algorithm on output",
-"",
-"LZW and deflate options:",
-" # set predictor value",
-"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+#endif
NULL
};
@@ -463,8 +476,8 @@ usage(int code)
FILE * out = (code == EXIT_SUCCESS) ? stdout : stderr;
fprintf(out, "%s\n\n", TIFFGetVersion());
- for (i = 0; stuff[i] != NULL; i++)
- fprintf(out, "%s\n", stuff[i]);
+ for (i = 0; usage_info[i] != NULL; i++)
+ fprintf(out, "%s\n", usage_info[i]);
exit(code);
}
diff --git a/tools/ppm2tiff.c b/tools/ppm2tiff.c
index c6332439..7f50bdd6 100644
--- a/tools/ppm2tiff.c
+++ b/tools/ppm2tiff.c
@@ -489,26 +489,40 @@ processCompressOptions(char* opt)
return (1);
}
-const char* stuff[] = {
+const char* usage_info[] = {
"usage: ppm2tiff [options] input.ppm output.tif",
"where options are:",
" -r # make each strip have no more than # rows",
" -R # set x&y resolution (dpi)",
"",
+#ifdef JPEG_SUPPORT
" -c jpeg[:opts] compress output with JPEG encoding",
+/* "JPEG options:", */
+" # set compression quality level (0-100, default 75)",
+" r output color image as RGB rather than YCbCr",
+#endif
+#ifdef LZW_SUPPORT
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
+/* " LZW options:", */
+" # set predictor value",
+" For example, -c lzw:2 for LZW-encoded data with horizontal differencing",
+#endif
+#ifdef ZIP_SUPPORT
" -c zip[:opts] compress output with deflate encoding",
-" -c packbits compress output with packbits encoding (the default)",
+/* " Deflate (ZIP) options:", */
+" # set predictor value",
+#endif
+#ifdef PACKBITS_SUPPORT
+" -c packbits compress output with packbits encoding (the default)",
+#endif
+#ifdef CCITT_SUPPORT
" -c g3[:opts] compress output with CCITT Group 3 encoding",
" -c g4 compress output with CCITT Group 4 encoding",
-" -c none use no compression algorithm on output",
+#endif
+#if defined(JPEG_SUPPORT) || defined(LZW_SUPPORT) || defined(ZIP_SUPPORT) || defined(PACKBITS_SUPPORT) || defined(CCITT_SUPPORT)
+" -c none use no compression algorithm on output",
+#endif
"",
-"JPEG options:",
-" # set compression quality level (0-100, default 75)",
-" r output color image as RGB rather than YCbCr",
-"LZW and deflate options:",
-" # set predictor value",
-"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
NULL
};
@@ -519,8 +533,8 @@ usage(int code)
FILE * out = (code == EXIT_SUCCESS) ? stdout : stderr;
fprintf(out, "%s\n\n", TIFFGetVersion());
- for (i = 0; stuff[i] != NULL; i++)
- fprintf(out, "%s\n", stuff[i]);
+ for (i = 0; usage_info[i] != NULL; i++)
+ fprintf(out, "%s\n", usage_info[i]);
exit(code);
}
diff --git a/tools/raw2tiff.c b/tools/raw2tiff.c
index 8bbdc045..718c230f 100644
--- a/tools/raw2tiff.c
+++ b/tools/raw2tiff.c
@@ -378,7 +378,7 @@ guessSize(int fd, TIFFDataType dtype, _TIFF_off_t hdr_size, uint32 nbands,
char *buf1, *buf2;
_TIFF_stat_s filestat;
uint32 w, h, scanlinesize, imagesize;
- uint32 depth = TIFFDataWidth(dtype);
+ uint32 depth = TIFFDataWidth(dtype);
double cor_coef = 0, tmp;
if (_TIFF_fstat_f(fd, &filestat) == -1) {
@@ -624,7 +624,7 @@ processCompressOptions(char* opt)
return (1);
}
-static const char* stuff[] = {
+static const char* usage_info[] = {
"raw2tiff --- tool for converting raw byte sequences in TIFF images",
"usage: raw2tiff [options] input.raw output.tif",
"where options are:",
@@ -665,20 +665,31 @@ static const char* stuff[] = {
" pixel pixel interleaved data (default)",
" band band interleaved data",
"",
+#ifdef LZW_SUPPORT
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
+/* " LZW options:", */
+" # set predictor value",
+" For example, -c lzw:2 for LZW-encoded data with horizontal differencing",
+#endif
+#ifdef ZIP_SUPPORT
" -c zip[:opts] compress output with deflate encoding",
+/* " Deflate (ZIP) options:", */
+" # set predictor value",
+#endif
+#ifdef JPEG_SUPPORT
" -c jpeg[:opts] compress output with JPEG encoding",
+/* " JPEG options:", */
+" # set compression quality level (0-100, default 75)",
+" r output color image as RGB rather than YCbCr",
+" For example, -c jpeg:r:50 for JPEG-encoded RGB data with 50% comp. quality",
+#endif
+#ifdef PACKBITS_SUPPORT
" -c packbits compress output with packbits encoding",
+#endif
+#if defined(LZW_SUPPORT) || defined(ZIP_SUPPORT) || defined(JPEG_SUPPORT) || defined(PACKBITS_SUPPORT)
" -c none use no compression algorithm on output",
+#endif
"",
-"JPEG options:",
-" # set compression quality level (0-100, default 75)",
-" r output color image as RGB rather than YCbCr",
-"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",
-"",
-"LZW and deflate options:",
-" # set predictor value",
-"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
" -o out.tif write output to out.tif",
" -h this help message",
NULL
@@ -691,8 +702,8 @@ usage(int code)
FILE * out = (code == EXIT_SUCCESS) ? stdout : stderr;
fprintf(out, "%s\n\n", TIFFGetVersion());
- for (i = 0; stuff[i] != NULL; i++)
- fprintf(out, "%s\n", stuff[i]);
+ for (i = 0; usage_info[i] != NULL; i++)
+ fprintf(out, "%s\n", usage_info[i]);
exit(code);
}
diff --git a/tools/rgb2ycbcr.c b/tools/rgb2ycbcr.c
index 482cc5b4..0bf761af 100644
--- a/tools/rgb2ycbcr.c
+++ b/tools/rgb2ycbcr.c
@@ -46,6 +46,10 @@
#define EXIT_FAILURE 1
#endif
+#ifndef HAVE_GETOPT
+extern int getopt(int argc, char * const argv[], const char *optstring);
+#endif
+
#define streq(a,b) (strcmp(a,b) == 0)
#define CopyField(tag, v) \
if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
@@ -364,19 +368,33 @@ tiffcvt(TIFF* in, TIFF* out)
return result;
}
-const char* stuff[] = {
- "usage: rgb2ycbcr [-c comp] [-r rows] [-h N] [-v N] input... output\n",
- "where comp is one of the following compression algorithms:\n",
- " jpeg\t\tJPEG encoding\n",
- " lzw\t\tLempel-Ziv & Welch encoding\n",
- " zip\t\tdeflate encoding\n",
- " packbits\tPackBits encoding (default)\n",
- " none\t\tno compression\n",
- "and the other options are:\n",
- " -r\trows/strip\n",
- " -h\thorizontal sampling factor (1,2,4)\n",
- " -v\tvertical sampling factor (1,2,4)\n",
- NULL
+const char* usage_info[] = {
+/* Help information format modified for the sake of consistency with the other tiff tools */
+/* "usage: rgb2ycbcr [-c comp] [-r rows] [-h N] [-v N] input... output\n", */
+/* "where comp is one of the following compression algorithms:\n", */
+"usage: rgb2ycbcr [options] input output",
+"where options are:",
+#ifdef JPEG_SUPPORT
+" -c jpeg JPEG encoding",
+#endif
+#ifdef ZIP_SUPPORT
+" -c zip Zip/Deflate encoding",
+#endif
+#ifdef LZW_SUPPORT
+" -c lzw Lempel-Ziv & Welch encoding",
+#endif
+#ifdef PACKBITS_SUPPORT
+" -c packbits PackBits encoding (default)",
+#endif
+#if defined(JPEG_SUPPORT) || defined(LZW_SUPPORT) || defined(ZIP_SUPPORT) || defined(PACKBITS_SUPPORT)
+" -c none no compression",
+#endif
+"",
+/* "and the other options are:\n", */
+" -r rows/strip",
+" -h horizontal sampling factor (1,2,4)",
+" -v vertical sampling factor (1,2,4)",
+NULL
};
static void
@@ -386,8 +404,8 @@ usage(int code)
FILE * out = (code == EXIT_SUCCESS) ? stdout : stderr;
fprintf(out, "%s\n\n", TIFFGetVersion());
- for (i = 0; stuff[i] != NULL; i++)
- fprintf(out, "%s\n", stuff[i]);
+ for (i = 0; usage_info[i] != NULL; i++)
+ fprintf(out, "%s\n", usage_info[i]);
exit(code);
}
diff --git a/tools/tiff2bw.c b/tools/tiff2bw.c
index 654bd324..ff1487d4 100644
--- a/tools/tiff2bw.c
+++ b/tools/tiff2bw.c
@@ -47,6 +47,10 @@
#define EXIT_FAILURE 1
#endif
+#ifndef HAVE_GETOPT
+extern int getopt(int argc, char * const argv[], const char *optstring);
+#endif
+
/* x% weighting -> fraction of full color */
#define PCT(x) (((x)*256+50)/100)
int RED = PCT(30); /* 30% */
@@ -501,7 +505,7 @@ cpTags(TIFF* in, TIFF* out)
}
#undef NTAGS
-const char* stuff[] = {
+const char* usage_info[] = {
"usage: tiff2bw [options] input.tif output.tif",
"where options are:",
" -R % use #% from red channel",
@@ -510,16 +514,28 @@ const char* stuff[] = {
"",
" -r # make each strip have no more than # rows",
"",
+#ifdef LZW_SUPPORT
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
+/* " LZW options:", */
+" # set predictor value",
+" For example, -c lzw:2 for LZW-encoded data with horizontal differencing",
+#endif
+#ifdef ZIP_SUPPORT
" -c zip[:opts] compress output with deflate encoding",
+/* " Deflate (ZIP) options:", */
+" # set predictor value",
+#endif
+#ifdef PACKBITS_SUPPORT
" -c packbits compress output with packbits encoding",
+#endif
+#ifdef CCITT_SUPPORT
" -c g3[:opts] compress output with CCITT Group 3 encoding",
" -c g4 compress output with CCITT Group 4 encoding",
+#endif
+#if defined(LZW_SUPPORT) || defined(ZIP_SUPPORT) || defined(PACKBITS_SUPPORT) || defined(CCITT_SUPPORT)
" -c none use no compression algorithm on output",
+#endif
"",
-"LZW and deflate options:",
-" # set predictor value",
-"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
NULL
};
@@ -530,8 +546,8 @@ usage(int code)
FILE * out = (code == EXIT_SUCCESS) ? stdout : stderr;
fprintf(out, "%s\n\n", TIFFGetVersion());
- for (i = 0; stuff[i] != NULL; i++)
- fprintf(out, "%s\n", stuff[i]);
+ for (i = 0; usage_info[i] != NULL; i++)
+ fprintf(out, "%s\n", usage_info[i]);
exit(code);
}
diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
index acaef0d6..54b3e651 100644
--- a/tools/tiff2pdf.c
+++ b/tools/tiff2pdf.c
@@ -263,7 +263,7 @@ typedef struct {
/* These functions are called by main. */
-static void tiff2pdf_usage(int);
+static void usage_info(int);
int tiff2pdf_match_paper_size(float*, float*, char*);
/* These functions are used to generate a PDF from a TIFF. */
@@ -557,8 +557,12 @@ checkMultiply64(uint64 first, uint64 second, T2P* t2p)
options:
-o: output to file name
+#ifdef JPEG_SUPPORT
-j: compress with JPEG (requires libjpeg configured with libtiff)
- -z: compress with Zip/Deflate (requires zlib configured with libtiff)
+#endif
+#ifdef ZIP_SUPPORT
+printf (-z: compress with Zip/Deflate (requires zlib configured with libtiff));
+#endif
-q: compression quality
-n: no compressed data passthrough
-d: do not compress (decompress)
@@ -755,10 +759,10 @@ int main(int argc, char** argv){
t2p->pdf_image_interpolate = 1;
break;
case 'h':
- tiff2pdf_usage(EXIT_SUCCESS);
+ usage_info(EXIT_SUCCESS);
goto success;
case '?':
- tiff2pdf_usage(EXIT_FAILURE);
+ usage_info(EXIT_FAILURE);
goto fail;
}
}
@@ -776,14 +780,14 @@ int main(int argc, char** argv){
}
} else {
TIFFError(TIFF2PDF_MODULE, "No input file specified");
- tiff2pdf_usage(EXIT_FAILURE);
+ usage_info(EXIT_FAILURE);
goto fail;
}
if(argc > optind) {
TIFFError(TIFF2PDF_MODULE,
"No support for multiple input files");
- tiff2pdf_usage(EXIT_FAILURE);
+ usage_info(EXIT_FAILURE);
goto fail;
}
@@ -845,10 +849,10 @@ success:
}
-static void tiff2pdf_usage(int code) {
+static void usage_info(int code) {
static const char* lines[]={
"usage: tiff2pdf [options] input.tiff",
- "options:",
+ "where options are:",
" -o: output to file name",
#ifdef JPEG_SUPPORT
" -j: compress with JPEG",
@@ -856,9 +860,11 @@ static void tiff2pdf_usage(int code) {
#ifdef ZIP_SUPPORT
" -z: compress with Zip/Deflate",
#endif
+#if defined(JPEG_SUPPORT) || defined(ZIP_SUPPORT)
" -q: compression quality",
" -n: no compressed data passthrough",
" -d: do not compress (decompress)",
+#endif
" -i: invert colors",
" -u: set distance unit, 'i' for inch, 'm' for centimeter",
" -x: set x resolution default in dots per unit",
@@ -1968,7 +1974,7 @@ void t2p_read_tiff_data(T2P* t2p, TIFF* input){
void t2p_read_tiff_size(T2P* t2p, TIFF* input){
uint64* sbc=NULL;
-#if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)
+#if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)
unsigned char* jpt=NULL;
tstrip_t i=0;
tstrip_t stripcount=0;
diff --git a/tools/tiff2rgba.c b/tools/tiff2rgba.c
index 764395f6..675c557b 100644
--- a/tools/tiff2rgba.c
+++ b/tools/tiff2rgba.c
@@ -46,6 +46,10 @@
#define EXIT_FAILURE 1
#endif
+#ifndef HAVE_GETOPT
+extern int getopt(int argc, char * const argv[], const char *optstring);
+#endif
+
#define streq(a,b) (strcmp(a,b) == 0)
#define CopyField(tag, v) \
if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
@@ -558,21 +562,35 @@ tiffcvt(TIFF* in, TIFF* out)
return( cvt_whole_image( in, out ) );
}
-static const char* stuff[] = {
- "usage: tiff2rgba [-c comp] [-r rows] [-b] [-n] [-8] [-M size] input... output",
- "where comp is one of the following compression algorithms:",
- " jpeg\t\tJPEG encoding",
- " zip\t\tZip/Deflate encoding",
- " lzw\t\tLempel-Ziv & Welch encoding",
- " packbits\tPackBits encoding",
- " none\t\tno compression",
- "and the other options are:",
- " -r\trows/strip",
- " -b (progress by block rather than as a whole image)",
- " -n don't emit alpha component.",
- " -8 write BigTIFF file instead of ClassicTIFF",
- " -M set the memory allocation limit in MiB. 0 to disable limit",
- NULL
+static const char* usage_info[] = {
+/* Help information format modified for the sake of consistency with the other tiff tools */
+/* "usage: tiff2rgba [-c comp] [-r rows] [-b] [-n] [-8] [-M size] input... output", */
+/* "where comp is one of the following compression algorithms:", */
+"usage: tiff2rgba [options] input output",
+"where options are:",
+#ifdef JPEG_SUPPORT
+" -c jpeg JPEG encoding",
+#endif
+#ifdef ZIP_SUPPORT
+" -c zip Zip/Deflate encoding",
+#endif
+#ifdef LZW_SUPPORT
+" -c lzw Lempel-Ziv & Welch encoding",
+#endif
+#ifdef PACKBITS_SUPPORT
+" -c packbits PackBits encoding",
+#endif
+#if defined(JPEG_SUPPORT) || defined(ZIP_SUPPORT) || defined(LZW_SUPPORT) || defined(PACKBITS_SUPPORT)
+" -c none no compression",
+#endif
+"",
+/* "and the other options are:", */
+" -r rows/strip",
+" -b (progress by block rather than as a whole image)",
+" -n don't emit alpha component.",
+" -8 write BigTIFF file instead of ClassicTIFF",
+" -M set the memory allocation limit in MiB. 0 to disable limit",
+NULL
};
static void
@@ -582,8 +600,8 @@ usage(int code)
FILE * out = (code == EXIT_SUCCESS) ? stdout : stderr;
fprintf(out, "%s\n\n", TIFFGetVersion());
- for (i = 0; stuff[i] != NULL; i++)
- fprintf(out, "%s\n", stuff[i]);
+ for (i = 0; usage_info[i] != NULL; i++)
+ fprintf(out, "%s\n", usage_info[i]);
exit(code);
}
diff --git a/tools/tiffcp.c b/tools/tiffcp.c
index e56b1c10..cc9bb07b 100644
--- a/tools/tiffcp.c
+++ b/tools/tiffcp.c
@@ -443,7 +443,7 @@ processCompressOptions(char* opt)
return (1);
}
-static const char* stuff[] = {
+static const char* usage_info[] = {
"usage: tiffcp [options] input... output",
"where options are:",
" -a append to output instead of overwriting",
@@ -470,44 +470,76 @@ static const char* stuff[] = {
" -f lsb2msb force lsb-to-msb FillOrder for output",
" -f msb2lsb force msb-to-lsb FillOrder for output",
"",
+#ifdef LZW_SUPPORT
" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
+/* " LZW options:", */
+" # set predictor value",
+" p# set compression level (preset)",
+" For example, -c lzw:2 for LZW-encoded data with horizontal differencing",
+#endif
+#ifdef ZIP_SUPPORT
" -c zip[:opts] compress output with deflate encoding",
+/* " Deflate (ZIP) options:", */
+" # set predictor value",
+" p# set compression level (preset)",
+" For example, -c zip:3:p9 for maximum compression level and floating",
+" point predictor.",
+#endif
+#if defined(ZIP_SUPPORT) && defined(LIBDEFLATE_SUPPORT)
+" s# set subcodec: 0=zlib, 1=libdeflate (default 1)",
+/* " (only for Deflate/ZIP)", */
+#endif
+#ifdef LZMA_SUPPORT
" -c lzma[:opts] compress output with LZMA2 encoding",
+/* " LZMA options:", */
+" # set predictor value",
+" p# set compression level (preset)",
+#endif
+#ifdef ZSTD_SUPPORT
" -c zstd[:opts] compress output with ZSTD encoding",
+/* " ZSTD options:", */
+" # set predictor value",
+" p# set compression level (preset)",
+#endif
+#ifdef WEBP_SUPPORT
" -c webp[:opts] compress output with WEBP encoding",
+/* " WEBP options:", */
+" # set predictor value",
+" p# set compression level (preset)",
+#endif
+#ifdef JPEG_SUPPORT
" -c jpeg[:opts] compress output with JPEG encoding",
+/* " JPEG options:", */
+" # set compression quality level (0-100, default 75)",
+" r output color image as RGB rather than YCbCr",
+" For example, -c jpeg:r:50 for JPEG-encoded RGB with 50% comp. quality",
+#endif
+#ifdef JBIG_SUPPORT
" -c jbig compress output with ISO JBIG encoding",
+#endif
+#ifdef PACKBITS_SUPPORT
" -c packbits compress output with packbits encoding",
+#endif
+#ifdef CCITT_SUPPORT
" -c g3[:opts] compress output with CCITT Group 3 encoding",
+/* " CCITT Group 3 options:", */
+" 1d use default CCITT Group 3 1D-encoding",
+" 2d use optional CCITT Group 3 2D-encoding",
+" fill byte-align EOL codes",
+" For example, -c g3:2d:fill for G3-2D-encoded data with byte-aligned EOLs",
" -c g4 compress output with CCITT Group 4 encoding",
+#endif
+#ifdef LOGLUV_SUPPORT
" -c sgilog compress output with SGILOG encoding",
+#endif
+#if defined(LZW_SUPPORT) || defined(ZIP_SUPPORT) || defined(LZMA_SUPPORT) || defined(ZSTD_SUPPORT) || defined(WEBP_SUPPORT) || defined(JPEG_SUPPORT) || defined(JBIG_SUPPORT) || defined(PACKBITS_SUPPORT) || defined(CCITT_SUPPORT) || defined(LOGLUV_SUPPORT)
" -c none use no compression algorithm on output",
-"",
-"Group 3 options:",
-" 1d use default CCITT Group 3 1D-encoding",
-" 2d use optional CCITT Group 3 2D-encoding",
-" fill byte-align EOL codes",
-"For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs",
-"",
-"JPEG options:",
-" # set compression quality level (0-100, default 75)",
-" r output color image as RGB rather than YCbCr",
-"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",
-"",
-"LZW, Deflate (ZIP), LZMA2, ZSTD and WEBP options:",
-" # set predictor value",
-" p# set compression level (preset)",
-#if LIBDEFLATE_SUPPORT
-" s# set subcodec (0=zlib, 1=libdeflate) (only for Deflate/ZIP)",
#endif
-"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing,",
-"-c zip:3:p9 for Deflate encoding with maximum compression level and floating",
-"point predictor.",
"",
"Note that input filenames may be of the form filename,x,y,z",
"where x, y, and z specify image numbers in the filename to copy.",
-"example: tiffcp -c none -b esp.tif,1 esp.tif,0 test.tif",
-" subtract 2nd image in esp.tif from 1st yielding uncompressed result test.tif",
+"example: tiffcp -c none -b esp.tif,1 esp.tif,0 test.tif",
+" subtract 2nd image in esp.tif from 1st yielding uncompressed result test.tif",
NULL
};
@@ -518,8 +550,8 @@ usage(int code)
FILE * out = (code == EXIT_SUCCESS) ? stdout : stderr;
fprintf(out, "%s\n\n", TIFFGetVersion());
- for (i = 0; stuff[i] != NULL; i++)
- fprintf(out, "%s\n", stuff[i]);
+ for (i = 0; usage_info[i] != NULL; i++)
+ fprintf(out, "%s\n", usage_info[i]);
exit(code);
}
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index d20b585a..7e53525a 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -648,48 +648,59 @@ static void* limitMalloc(tmsize_t s)
static const char* usage_info[] = {
"usage: tiffcrop [options] source1 ... sourceN destination",
"where options are:",
-" -h Print this syntax listing",
-" -v Print tiffcrop version identifier and last revision date",
+" -h Print this syntax listing",
+" -v Print tiffcrop version identifier and last revision date",
" ",
-" -a Append to output instead of overwriting",
-" -d offset Set initial directory offset, counting first image as one, not zero",
-" -p contig Pack samples contiguously (e.g. RGBRGB...)",
-" -p separate Store samples separately (e.g. RRR...GGG...BBB...)",
-" -s Write output in strips",
-" -t Write output in tiles",
-" -i Ignore read errors",
-" -k size set the memory allocation limit in MiB. 0 to disable limit",
+" -a Append to output instead of overwriting",
+" -d offset Set initial directory offset, counting first image as one, not zero",
+" -p contig Pack samples contiguously (e.g. RGBRGB...)",
+" -p separate Store samples separately (e.g. RRR...GGG...BBB...)",
+" -s Write output in strips",
+" -t Write output in tiles",
+" -i Ignore read errors",
+" -k size set the memory allocation limit in MiB. 0 to disable limit",
" ",
-" -r # Make each strip have no more than # rows",
-" -w # Set output tile width (pixels)",
-" -l # Set output tile length (pixels)",
+" -r # Make each strip have no more than # rows",
+" -w # Set output tile width (pixels)",
+" -l # Set output tile length (pixels)",
" ",
-" -f lsb2msb Force lsb-to-msb FillOrder for output",
-" -f msb2lsb Force msb-to-lsb FillOrder for output",
+" -f lsb2msb Force lsb-to-msb FillOrder for output",
+" -f msb2lsb Force msb-to-lsb FillOrder for output",
"",
-" -c lzw[:opts] Compress output with Lempel-Ziv & Welch encoding",
-" -c zip[:opts] Compress output with deflate encoding",
+#ifdef LZW_SUPPORT
+" -c lzw[:opts] Compress output with Lempel-Ziv & Welch encoding",
+/* " LZW options:", */
+" # Set predictor value",
+" For example, -c lzw:2 for LZW-encoded data with horizontal differencing",
+#endif
+#ifdef ZIP_SUPPORT
+" -c zip[:opts] Compress output with deflate encoding",
+/* " Deflate (ZIP) options:", */
+" # Set predictor value",
+#endif
+#ifdef JPEG_SUPPORT
" -c jpeg[:opts] Compress output with JPEG encoding",
-" -c packbits Compress output with packbits encoding",
-" -c g3[:opts] Compress output with CCITT Group 3 encoding",
-" -c g4 Compress output with CCITT Group 4 encoding",
-" -c none Use no compression algorithm on output",
-" ",
-"Group 3 options:",
-" 1d Use default CCITT Group 3 1D-encoding",
-" 2d Use optional CCITT Group 3 2D-encoding",
-" fill Byte-align EOL codes",
-"For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs",
-" ",
-"JPEG options:",
-" # Set compression quality level (0-100, default 100)",
-" raw Output color image as raw YCbCr",
-" rgb Output color image as RGB",
-"For example, -c jpeg:rgb:50 to get JPEG-encoded RGB data with 50% comp. quality",
-" ",
-"LZW and deflate options:",
-" # Set predictor value",
-"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+/* " JPEG options:", */
+" # Set compression quality level (0-100, default 100)",
+" raw Output color image as raw YCbCr (default)",
+" rgb Output color image as RGB",
+" For example, -c jpeg:rgb:50 for JPEG-encoded RGB with 50% comp. quality",
+#endif
+#ifdef PACKBITS_SUPPORT
+" -c packbits Compress output with packbits encoding",
+#endif
+#ifdef CCITT_SUPPORT
+" -c g3[:opts] Compress output with CCITT Group 3 encoding",
+/* " CCITT Group 3 options:", */
+" 1d Use default CCITT Group 3 1D-encoding",
+" 2d Use optional CCITT Group 3 2D-encoding",
+" fill Byte-align EOL codes",
+" For example, -c g3:2d:fill for G3-2D-encoded data with byte-aligned EOLs",
+" -c g4 Compress output with CCITT Group 4 encoding",
+#endif
+#if defined(LZW_SUPPORT) || defined(ZIP_SUPPORT) || defined(JPEG_SUPPORT) || defined(PACKBITS_SUPPORT) || defined(CCITT_SUPPORT)
+" -c none Use no compression algorithm on output",
+#endif
" ",
"Page and selection options:",
" -N odd|even|#,#-#,#|last sequences and ranges of images within file to process",
diff --git a/tools/tiffdither.c b/tools/tiffdither.c
index a9d1b7c5..9ed761dd 100644
--- a/tools/tiffdither.c
+++ b/tools/tiffdither.c
@@ -46,6 +46,10 @@
#define EXIT_FAILURE 1
#endif
+#ifndef HAVE_GETOPT
+extern int getopt(int argc, char * const argv[], const char *optstring);
+#endif
+
#define streq(a,b) (strcmp(a,b) == 0)
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
@@ -305,29 +309,39 @@ main(int argc, char* argv[])
return (EXIT_SUCCESS);
}
-static const char* stuff[] = {
+static const char* usage_info[] = {
"usage: tiffdither [options] input.tif output.tif",
"where options are:",
-" -r # make each strip have no more than # rows",
-" -t # set the threshold value for dithering (default 128)",
-" -f lsb2msb force lsb-to-msb FillOrder for output",
-" -f msb2lsb force msb-to-lsb FillOrder for output",
-" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
-" -c zip[:opts] compress output with deflate encoding",
-" -c packbits compress output with packbits encoding",
-" -c g3[:opts] compress output with CCITT Group 3 encoding",
-" -c g4 compress output with CCITT Group 4 encoding",
-" -c none use no compression algorithm on output",
+" -r # make each strip have no more than # rows",
+" -t # set the threshold value for dithering (default 128)",
+" -f lsb2msb force lsb-to-msb FillOrder for output",
+" -f msb2lsb force msb-to-lsb FillOrder for output",
"",
-"Group 3 options:",
-" 1d use default CCITT Group 3 1D-encoding",
-" 2d use optional CCITT Group 3 2D-encoding",
-" fill byte-align EOL codes",
-"For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs",
+#ifdef LZW_SUPPORT
+" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
+" # set predictor value",
+" For example, -c lzw:2 for LZW-encoded data with horizontal differencing",
+#endif
+#ifdef ZIP_SUPPORT
+" -c zip[:opts] compress output with deflate encoding",
+" # set predictor value",
+#endif
+#ifdef PACKBITS_SUPPORT
+" -c packbits compress output with packbits encoding",
+#endif
+#ifdef CCITT_SUPPORT
+" -c g3[:opts] compress output with CCITT Group 3 encoding",
+" Group 3 options:",
+" 1d use default CCITT Group 3 1D-encoding",
+" 2d use optional CCITT Group 3 2D-encoding",
+" fill byte-align EOL codes",
+" For example, -c g3:2d:fill for G3-2D-encoded data with byte-aligned EOLs",
+" -c g4 compress output with CCITT Group 4 encoding",
+#endif
+#if defined(LZW_SUPPORT) || defined(ZIP_SUPPORT) || defined(PACKBITS_SUPPORT) || defined(CCITT_SUPPORT)
+" -c none use no compression algorithm on output",
+#endif
"",
-"LZW and deflate options:",
-" # set predictor value",
-"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
NULL
};
@@ -338,8 +352,8 @@ usage(int code)
FILE * out = (code == EXIT_SUCCESS) ? stdout : stderr;
fprintf(out, "%s\n\n", TIFFGetVersion());
- for (i = 0; stuff[i] != NULL; i++)
- fprintf(out, "%s\n", stuff[i]);
+ for (i = 0; usage_info[i] != NULL; i++)
+ fprintf(out, "%s\n", usage_info[i]);
exit(code);
}
diff --git a/tools/tiffmedian.c b/tools/tiffmedian.c
index 6654cd6f..f8b529ec 100644
--- a/tools/tiffmedian.c
+++ b/tools/tiffmedian.c
@@ -61,6 +61,10 @@
#define EXIT_FAILURE 1
#endif
+#ifndef HAVE_GETOPT
+extern int getopt(int argc, char * const argv[], const char *optstring);
+#endif
+
#define MAX_CMAP_SIZE 256
#define streq(a,b) (strcmp(a,b) == 0)
@@ -325,20 +329,31 @@ processCompressOptions(char* opt)
return (1);
}
-char* stuff[] = {
+char* usage_info[] = {
"usage: tiffmedian [options] input.tif output.tif",
"where options are:",
-" -r # make each strip have no more than # rows",
-" -C # create a colormap with # entries",
-" -f use Floyd-Steinberg dithering",
-" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
-" -c zip[:opts] compress output with deflate encoding",
-" -c packbits compress output with packbits encoding",
-" -c none use no compression algorithm on output",
+" -r # make each strip have no more than # rows",
+" -C # create a colormap with # entries",
+" -f use Floyd-Steinberg dithering",
+"",
+#ifdef LZW_SUPPORT
+" -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
+/* " LZW options:", */
+" # set predictor value",
+" For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+#endif
+#ifdef ZIP_SUPPORT
+" -c zip[:opts] compress output with deflate encoding",
+/* " Deflate (ZIP) options:", */
+" # set predictor value",
+#endif
+#ifdef PACKBITS_SUPPORT
+" -c packbits compress output with packbits encoding",
+#endif
+#if defined(LZW_SUPPORT) || defined(ZIP_SUPPORT) || defined(PACKBITS_SUPPORT)
+" -c none use no compression algorithm on output",
+#endif
"",
-"LZW and deflate options:",
-" # set predictor value",
-"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
NULL
};
@@ -349,8 +364,8 @@ usage(int code)
FILE * out = (code == EXIT_SUCCESS) ? stdout : stderr;
fprintf(out, "%s\n\n", TIFFGetVersion());
- for (i = 0; stuff[i] != NULL; i++)
- fprintf(out, "%s\n", stuff[i]);
+ for (i = 0; usage_info[i] != NULL; i++)
+ fprintf(out, "%s\n", usage_info[i]);
exit(code);
}