TIFFGETMAXCOMPRESSIONRATIO(3tiff)

πŸ“¦
version 4.7.2 Β· 4 versions
, in fedora 43, fedora 44

✨ TIFFGETMAXCOMPRESSIONRATIO ✨

okay bestie, welcome to the tiffio.h cinematic universe πŸ’– this one is from LibTIFF, and it's called TIFFGetMaxCompressionRatio β€” she's here to hand you the maximum compression ratio for the current codec. slay.

πŸŽ€ psst β€” she's a newer girlie, added in version 4.7.2.

🌸 SYNOPSIS 🌸

#include <tiffio.h>

uint64_t TIFFGetMaxCompressionRatio(TIFF *tif);

like, that's it. one function. one pointer. one uint64_t. iconic behavior fr fr πŸ’…


πŸ’« DESCRIPTION πŸ’«

so TIFFGetMaxCompressionRatio() returns the maximum compression ratio for the current codec. and the vibe is: this ratio is typically achieved for an uncompressed buffer with all bytes at zero. like, the most boring possible data, and the codec just goes feral on it πŸ¦‹

the way you'd actually use this? it's a reality check. you can use it to figure out whether the compressed size of a strip or tile is realistic compared to the expected uncompressed size β€” which, and this is the important part, helps prevent some denial-of-service scenarios. no cap. it's a security girlie.

and depending on the codec, she might also take into account the strip or tile size, the number of samples per pixel, etc. every codec gets to have its own little opinions πŸ’œ

now the honest part, ngl: some codecs don't implement that method, or they only do it for a subset of configurations β€” and those may return 0 when the maximum compression ratio is unknown. not a bug, just them being mysterious πŸ™ˆ


πŸ”₯ RETURN VALUES πŸ”₯

  • 0 β€” returned if no maximum compression ratio is known. mystery codec. no info. πŸ’€
  • 1 β€” returned when there is no compression.
  • values strictly bigger than 1 β€” returned when a maximum compression ratio is known. she ate πŸ‘‘

πŸ‘‘ AUTHOR πŸ‘‘

LibTIFF contributors


1988-2025, LibTIFF contributors


🌈 and that's the whole page, bestie. TIFFGetMaxCompressionRatio, LibTIFF, version 4.7, dated Jun 27, 2026 β€” go forth and vibe check your compression ratios πŸ’–βœ¨πŸ«Ά