2020.12.19 20:37 "[Tiff] tiffcp - Make the display of compression options conditional", by Miguel Medalha

2020.12.19 21:45 "Re: [Tiff] tiffcp - Make the display of compression options conditional", by Miguel Medalha

Here goes an updated proposal, taking into account the options for each compression method:

------------------------------------------------------------
#if LZW_SUPPORT 1
" -c lzw[:opts]   compress output with Lempel-Ziv & Welch encoding",
"    #            set predictor value",
"    p#           set compression level (preset)",
"    For example, -c lzw:2 to get LZW-encoded data with horizontal differencing,",
#endif
#if ZIP_SUPPORT 1
" -c zip[:opts]   compress output with deflate encoding",
"    Deflate (ZIP) options:",
"    #            set predictor value",
"    p#           set compression level (preset)",
"    -c zip:3:p9  for Deflate encoding with maximum compression level and floating",
"                 point predictor.",
#if LIBDEFLATE_SUPPORT
"    s#           set subcodec (0=zlib, 1=libdeflate) (only for Deflate/ZIP)",
#endif
#endif
#if LZMA_SUPPORT
" -c lzma[:opts]  compress output with LZMA2 encoding",
"    #            set predictor value",
"    p#           set compression level (preset)",
#endif
#if ZSTD_SUPPORT
" -c zstd[:opts]  compress output with ZSTD encoding",
"    #            set predictor value",
"    p#           set compression level (preset)",
#endif
#if WEBP_SUPPORT
" -c webp[:opts]  compress output with WEBP encoding",
"    #            set predictor value",
"    p#           set compression level (preset)",
#endif
#if JPEG_SUPPORT 1
" -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 to get JPEG-encoded RGB data with 50% comp. quality",
#endif
#if JBIG_SUPPORT 1
" -c jbig         compress output with ISO JBIG encoding",
#endif
#if PACKBITS_SUPPORT 1
" -c packbits     compress output with packbits encoding",
#endif
#if CCITT_SUPPORT 1
" -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 to get G3-2D-encoded data with byte-aligned EOLs",
" -c g4           compress output with CCITT Group 4 encoding",
#endif
#if LOGLUV_SUPPORT 1
" -c sgilog       compress output with SGILOG encoding",
#endif
" -c none         use no compression algorithm on output", 
------------------------------------------------------------

This gives a nicely formatted output. What do you think?

For testing, I used the following 'cmake' command line, which enables me to switch options on/off in order to see how they are reflected on tiffcp's output:

cmake -DCMAKE_BUILD_TYPE=RELEASE -Djpeg:BOOL=OFF -Dzlib:BOOL=OFF
-Djbig:BOOL=OFF -Dlibdeflate:BOOL=OFF -Dlzma:BOOL=OFF -Dzstd:BOOL=OFF
-Dwebp:BOOL=OFF -Djpeg12:BOOL=OFF -Dpixarlog:BOOL=OFF -Dold-jpeg:BOOL=OFF
-Dlzw:BOOL=OFF -Dpackbits:BOOL=OFF -Dccitt:BOOL=OFF -Dlogluv:BOOL=OFF
-Dthunder:BOOL=OFF -Dnext:BOOL=OFF -S . -B .\cmakebuild && cmake --build
.\cmakebuild --config Release