Slow writing of tiff

Thanks for checking. Would it be shown as Deflate? See below, together with other evidences for support of ZIP. Not that I want to add extra work for you, really, just sharing what I found.

LibTIFF, a library for reading and writing TIFF files, supports various compression schemes, including Deflate, also known as ZIP compression.

From tiffcp source code I get

else if (strneq(opt, "zip", 3))
    {
        processZIPOptions(opt);
        defcompression = COMPRESSION_ADOBE_DEFLATE;
    }

showing COMPRESSION_ADOBE_DEFLATE as the compression type. Also,

#ifdef ZIP_SUPPORT
    " -c zip[:opts]   compress output with deflate encoding\n"
    /* "    Deflate (ZIP) options:", */
    "    #            set predictor value\n"
    "    p#           set compression level (preset)\n"
    "    For example, -c zip:3:p9 for maximum compression level and floating\n"
    "                 point predictor.\n"
#endif
#if defined(ZIP_SUPPORT) && defined(LIBDEFLATE_SUPPORT)
    "    s#           set subcodec: 0=zlib, 1=libdeflate (default 1)\n"
/* "                 (only for Deflate/ZIP)", */
#endif

ZIP_SUPPORT is defined in my system (Ubuntu) in tiffconf.h,

/usr/include/x86_64-linux-gnu/tiffconf.h:#define ZIP_SUPPORT 1

/* Support Deflate compression */
#define ZIP_SUPPORT 1

libdeflate-dev gets installed when libtiff-dev is installed,

/* Support libdeflate enhanced compression */
#define LIBDEFLATE_SUPPORT 1

Here an excerpt from file tiff.h :

#define TIFFTAG_COMPRESSION             259     /* data compression technique */
#define     COMPRESSION_NONE            1       /* dump mode */
#define     COMPRESSION_CCITTRLE        2       /* CCITT modified Huffman RLE */
#define     COMPRESSION_CCITTFAX3       3       /* CCITT Group 3 fax encoding */
#define     COMPRESSION_CCITT_T4        3       /* CCITT T.4 (TIFF 6 name) */
#define     COMPRESSION_CCITTFAX4       4       /* CCITT Group 4 fax encoding */
#define     COMPRESSION_CCITT_T6        4       /* CCITT T.6 (TIFF 6 name) */
#define     COMPRESSION_LZW             5       /* Lempel-Ziv  & Welch */
#define     COMPRESSION_OJPEG           6       /* !6.0 JPEG */
#define     COMPRESSION_JPEG            7       /* %JPEG DCT compression */
#define     COMPRESSION_T85                     9       /* !TIFF/FX T.85 JBIG compression */
#define     COMPRESSION_T43                     10      /* !TIFF/FX T.43 colour by layered JBIG compression */
#define     COMPRESSION_NEXT            32766   /* NeXT 2-bit RLE */
#define     COMPRESSION_CCITTRLEW       32771   /* #1 w/ word alignment */
#define     COMPRESSION_PACKBITS        32773   /* Macintosh RLE */
#define     COMPRESSION_THUNDERSCAN     32809   /* ThunderScan RLE */
/* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
#define     COMPRESSION_IT8CTPAD        32895   /* IT8 CT w/padding */
#define     COMPRESSION_IT8LW           32896   /* IT8 Linework RLE */
#define     COMPRESSION_IT8MP           32897   /* IT8 Monochrome picture */
#define     COMPRESSION_IT8BL           32898   /* IT8 Binary line art */
/* compression codes 32908-32911 are reserved for Pixar */
#define     COMPRESSION_PIXARFILM       32908   /* Pixar companded 10bit LZW */
#define     COMPRESSION_PIXARLOG        32909   /* Pixar companded 11bit ZIP */
#define     COMPRESSION_DEFLATE         32946   /* Deflate compression */
#define     COMPRESSION_ADOBE_DEFLATE   8       /* Deflate compression,
                                                   as recognized by Adobe */
/* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
#define     COMPRESSION_DCS             32947   /* Kodak DCS encoding */
#define     COMPRESSION_JBIG            34661   /* ISO JBIG */
#define     COMPRESSION_SGILOG          34676   /* SGI Log Luminance RLE */
#define     COMPRESSION_SGILOG24        34677   /* SGI Log 24-bit packed */
#define     COMPRESSION_JP2000          34712   /* Leadtools JPEG2000 */
#define     COMPRESSION_LERC            34887   /* ESRI Lerc codec: https://github.com/Esri/lerc */
/* compression codes 34887-34889 are reserved for ESRI */
#define     COMPRESSION_LZMA            34925   /* LZMA2 */
#define     COMPRESSION_ZSTD            50000   /* ZSTD: WARNING not registered in Adobe-maintained registry */
#define     COMPRESSION_WEBP            50001   /* WEBP: WARNING not registered in Adobe-maintained registry */
#define     COMPRESSION_JXL             50002   /* JPEGXL: WARNING not registered in Adobe-maintained registry */

What I propose then is to allow all these kind of compression techniques in G’MIC, by specifying the compression COMPRESSION_XXX as the string xxx or XXX.

and

I’ll post new prerelease sources and package probably tomorrow.

That will be excellent, thanks!

I don’t know why COMPRESSION_ZIP is not included since it is so commonly used by that name, ZIP, also referenced by tiffcp, which comes with libtiff package (they don’t list DEFLATE as a compression option),

 -c zip[:opts]   compress output with deflate encoding

In fact, I have this in my tiff.h, note the legacy tag observation,

#define COMPRESSION_DEFLATE 32946   /* Deflate compression, legacy tag */

When I use tiffcp -c zip to compress the compression tag in the file is then AdobeDeflate not Deflate, as shown below after calling tiffinfo foot.tif

=== TIFF directory 1267 ===
TIFF Directory at offset 0x9ce1a46 (164502086)
Image Width: 820 Image Length: 612
Bits/Sample: 8
Compression Scheme: AdobeDeflate
Photometric Interpretation: min-is-black
…

All this to say that it would probably be advantageous to have ā€˜zip’ as an option when saving a tiff with gmic, if at all possible, e.g.

gmic .... -o foot.tif,uint16,zip

Thank you!

Yes I can do that, I will associate the term ā€œzipā€ to ā€œadobe_deflateā€.

Wonderful. Thanks!