LIBTIFF(3tiff)
π NAME π
libtiff β an intro to libtiff, the library for reading and writing TIFF files. This is the manual page LIBTIFF(3tiff), bestie, and it's a long one so buckle up. π
β¨ SYNOPSIS β¨
#include <tiffio.h>
cc file.c -ltiff
like. that's it. that's the whole vibe. you include the header, you link the lib, you go off. π
πΈ DESCRIPTION πΈ
So libtiff is a library for reading and writing data files encoded with the "Tag Image File" format, Revision 6.0 (or revision 5.0, or revision 4.0 β we're not picky, we support all three π). This file format is literally made for archiving multi-color and monochromatic image data. iconic behaviour, no cap.
The library supports several compression algorithms, and you pick which one via the Compression field:
- no compression (
1) β raw, unfiltered, no thoughts head empty - CCITT 1D Huffman compression (
2) - CCITT Group 3 Facsimile compression (
3) - CCITT Group 4 Facsimile compression (
4) - Lempel-Ziv & Welch compression (
5) - baseline JPEG compression (
7) - word-aligned 1D Huffman compression (
32771) - PackBits compression (
32773)
and then there's a whole other group of nonstandard compression algorithms that are also supported, because libtiff is generous like that:
- the 4-bit compression algorithm used by the ThunderScan program (
32809) β decompression only, so read-only, don't come for me - NeXT's 2-bit compression algorithm (
32766) β also decompression only π - an experimental LZ-style algorithm known as Deflate (
32946) - an experimental CIE LogLuv compression scheme designed for images with high dynamic range (
32845for LogL, and32845for LogLuv)
okay and now for the byte stuff π¦ Directory information may be in either little- or big-endian byte order, and the byte swapping is done automatically by the library β you don't have to do a thing, it just handles it, we love a self-sufficient queen. Data bit ordering may be either Most Significant Bit (MSB) to Least Significant Bit (LSB) or LSB to MSB.
and finally, the one limitation bestie, so listen up: the library does not support files in which the BitsPerSample, Compression, MinSampleValue, or MaxSampleValue fields are defined differently on a per-sample basis. (In Rev. 6.0 the Compression tag is not defined on a per-sample basis, so this is immaterial anyway. π) so like. don't do that.
π§ DATA TYPES π§
The library makes extensive use of C typedefs to promote portability β two whole sets of them, actually: one for communication with clients of the library, and one for internal data structures and parsing of the TIFF format. The following typedefs are exposed to users either through function definitions or through parameters passed through the varargs interfaces. π
typedef int64_t tmsize_t; /* signed size type (int32_t on 32-bit platforms) */
typedef void* thandle_t; /* client data handle */
typedef uint64_t toff_t; /* file offset */
typedef uint32_t tdir_t; /* directory index */
π Deprecated typedefs π
The following typedefs are deprecated and should be replaced by their defining counterparts. yes bestie, they're old, they're still here, but move on:
typedef uint32_t ttag_t; /* directory tag */
typedef uint16_t tsample_t; /* sample number */
typedef uint32_t tstrile_t; /* strip or tile number */
typedef tstrile_t tstrip_t; /* strip number */
typedef tstrile_t ttile_t; /* tile number */
typedef tmsize_t tsize_t; /* i/o size in bytes */
typedef void *tdata_t; /* image data ref */
π the fine print π
- Note that
tstrip_t,ttile_t, andtsize_tare constrained to be no more than 32-bit quantities by the 32-bit fields they are stored in in the TIFF image. so that's a hard ceiling, not a suggestion. - Likewise
tsample_tis limited by the 16-bit field used to store theSamplesPerPixeltag. tdir_tconstrains the maximum number of IFDs that may appear in an image and may be an arbitrary size (w/o penalty). Starting with libtiff 4.5.0,tdir_tis a 32-bit unsigned integer. Previously, it was a 16-bit unsigned integer. glow-up fr fr. β¨ttag_tmust be eitherint,unsigned int, pointer, ordoubleβ because the library uses a varargs interface and C restricts the type of the parameter before an ellipsis to be a promoted type.toff_tis defined asuint64_tbecause TIFF file offsets are (unsigned) 32-bit quantities, and BigTIFF file offsets are unsigned 64-bit quantities. A signed value is used because some interfaces return-1on error. (yes,-1my beloved error sentinel π)- Finally, note that user-specified data references are passed as opaque handles and only cast at the lowest layers where their type is presumed.
π«Ά LIST OF ROUTINES π«Ά
The following routines are part of the library. Consult specific manual pages for details on their operation; on most systems doing man function-name will work. easy. π
bestie we are SO not done β this page keeps going, more parts incoming π don't go anywhere π¦
π LIBTIFF FUNCTIONS π
okay bestie, this is the big alphabetical roster of functions β the whole squad, listed by name, each with a one-liner about what it does. no skipping, no skimming, we're reading all of it together like the icons we are. π
TIFFAccessTagMethods()β hands your app read/write access to theTIFFTagMethodssitting inside the TIFF structure, so you can poke at them without getting your hands on the private TIFF structure itself. peek, don't touch the internals, periodt. π«ΆTIFFCheckpointDirectory()β writes out the current state of the directory. it's giving "save point but make it TIFF". πΎTIFFCheckTile()β checks whether everyx,y,z,samplecombo is actually within the image. yes queen, verify before you vibe. β¨TIFFCIELabToRGBInit()β initializes the CIE L*a*b* 1976 β RGB conversion state. setting the stage, warming up the lights. π¬TIFFCIELabToXYZ()β actually performs the CIE L*a*b* 1976 β CIE XYZ conversion. math but make it fashion. πTIFFCleanup()β the auxiliary function that frees the TIFF structure. the cleanup crew, the girls who close the tab, the ones who turn off the lights. π§ΉTIFFClientdata()β returns the open file'sclientdatahandle β that's the thing representing the file descriptor used inside libtiff. lowkey the ID badge for your file. πͺͺTIFFClientOpen()β opens a file for reading or writing. the classic entrance. πTIFFClientOpenExt()β opens a file for reading or writing with options, like re-entrant error and warning handlers getting passed in. same opening energy, extra sparkle. βTIFFClose()β closes a TIFF file you previously opened. say bye bestie, we're done here. πTIFFComputeStrip()β returns the strip that containsy,sample. find your strip, know your strip. π¦TIFFComputeTile()β returns the tile that containsx,y,z,sample. the tile-finding equivalent, equally iconic. πΈTIFFCreateCustomDirectory()β sets things up for a custom directory in an open TIFF file. bespoke. artisanal. you. πTIFFCreateDirectory()β sets things up for a directory in an open TIFF file. the standard-issue version, still slaying. β¨TIFFCreateEXIFDirectory()β sets things up for an EXIF custom directory in an open TIFF file, within a TIFF tag. exif girlies rise. πΈTIFFCreateGPSDirectory()β sets things up for a GPS custom directory in an open TIFF file, within a TIFF tag. she knows exactly where she is. πTIFFCurrentDirectory()β returns the index of the current directory. where am i? here. the answer is here. π―TIFFCurrentDirOffset()β returns the file offset of the current directory, instead of an index. different coordinate system, same main character energy. π§TIFFCurrentRow()β returns the index of the current scanline. row by row, we rise. πTIFFCurrentStrip()β returns the index of the current strip. πTIFFCurrentTile()β returns the index of the current tile. the trio is complete, we love a matching set. πTIFFDataWidth()β returns the size of TIFF data types. yes, we're measuring. πTIFFDefaultStripSize()β returns the number of rows for a reasonable-sized strip, based on the current settings of theImageWidth,BitsPerSampleandSamplesPerPixeltags, plus any compression-specific requirements. she reads the room and picks a sensible number, no cap. π₯
...and the list just keeps going, bestie, we're not even close to done π
TIFFDefaultTileSize()β hands you back the pixel width and height of a reasonable-sized tile; perfect for setting up theTileWidthandTileLengthtags β¨TIFFDeferStrileArrayWriting()β an advanced writing function that lets you control when and where the[Strip/Tile][Offsets/ByteCounts]arrays get written into the file, and it must be used in one very particular sequence together withTIFFForceStrileArrayWriting()(go read the description, iykyk, do not freestyle this one) π₯TIFFError()β the library-wide error handling function, prints tostderrπ«ΆTIFFErrorExt()β a user-specific library-wide error handling function that can be passed a file handle; inside libtiff that handle gets set to the open TIFF fileTIFFErrorExtR()β a user-specific re-entrant library error handling function, and you pass it itsTIFFstructure, which carries the pointer to a user-specific data object β¨TIFFFdOpen()β open a file for reading or writingTIFFFdOpenExt()β open a file for reading or writing with options, like re-entrant error and warning handlers you can pass in πTIFFFieldDataType()β get the data type from the field informationTIFFFieldIsAnonymous()β tells you whether the field was unknown to libtiff and got auto-registered πTIFFFieldName()β get the field name from the field informationTIFFFieldPassCount()β get whether to pass a value count toGet/SetFieldTIFFFieldReadCount()β get the number of values to be read from the fieldTIFFFieldSetGetCountSize()β returns the size of the count parameter ofTIFFSetField()andTIFFGetField()TIFFFieldSetGetSize()β returns the data size, in bytes, of the field data type used for libtiff internal storage πΎTIFFFieldTag()β get the tag value from the field informationTIFFFieldWithName()β get the field information given a field nameTIFFFieldWithTag()β get the field information given a tagTIFFFieldWriteCount()β get the number of values to be written to the fieldTIFFFileName()β returns the name of the open file πTIFFFileno()β returns the open file descriptorTIFFFindCODEC()β finds the standard codec for that specific scheme πTIFFFindField()β get the field information given a tag and a data typeTIFFFlush()β flush all pending writes πTIFFFlushData()β flush pending data writesTIFFForceStrileArrayWriting()β an advanced writing functionTIFFFreeDirectory()β frees up the storage that was hanging out with a directory π like, bye storage, we're done hereTIFFGetBitRevTable()β hands you back the bit reversal table β¨TIFFGetClientInfo()β gives you a pointer to the data of the entry with that name in the clientinfo-list, iykyk πTIFFGetCloseProc()β returns a pointer to the file close method π«ΆTIFFGetConfiguredCODECs()β gets the list of configured codecs β both the built-in ones and the ones a user registered, no cap π₯TIFFGetField()β returns the tag value in the current directory πTIFFGetFieldDefaulted()β same vibe, returns the tag value in the current directory, but with the default value set if the value isn't already set and a default is defined πΈTIFFGetMaxCompressionRatio()β returns the maximum compression ratio for the current codec π (it's giving "how small can we make this")TIFFGetMapFileProc()β returns a pointer to the memory mapping method π¦TIFFGetMode()β returns the open file mode βTIFFGetReadProc()β returns a pointer to the file read method πTIFFGetSeekProc()β returns a pointer to the file seek method β¨TIFFGetSizeProc()β returns a pointer to the file size requesting method πTIFFGetStrileByteCount()β returns the value of theTileByteCounts/StripByteCountsarray for the specified tile/strile π§TIFFGetStrileByteCountWithErr()β literally the same asTIFFGetStrileByteCount()but it also provides an error return, so you're not left guessing πTIFFGetStrileOffset()β returns the value of theTileOffsets/StripOffsetsarray for the specified tile/strile πTIFFGetStrileOffsetWithErr()β same asTIFFGetStrileOffset()and additionally provides an error return, bestie πTIFFGetTagListCount()β returns the number of entries in the custom tag list πTIFFGetTagListEntry()β returns the tag number of the (n.th - 1) entry within the custom tag list πTIFFGetUnmapFileProc()β returns a pointer to the memory unmapping method πTIFFGetVersion()β returns the library version string βTIFFGetWriteProc()β returns a pointer to the file write method πTIFFIsBigEndian()β returns a non-zero value if the file is BigEndian and zero if the file is LittleEndian πΈTIFFIsBigTIFF()β returns a non-zero value if the file is in BigTIFF style β¨TIFFIsByteSwapped()β returns true if the image data is byte-swapped π¦TIFFIsCODECConfigured()β checks whether we have a working codec π₯TIFFIsMSB2LSB()β bestie this one just says true if the image data you're getting handed back is coming at you with bit 0 as the most significant bit πTIFFIsTiled()β returns true if the image data is tiled, no cap π§©TIFFIsUpSampled()β gives you a non-zero value if the image data returned through the read interface Routines is being up-sampled. that's it, that's the whole vibe β¨TIFFLastDirectory()β non-zero value if the current directory is the last directory in the file; otherwise you get zero, sorry babes πTIFFMergeFieldInfo()β this one adds application defined TIFF tags into the list of known libtiff tags. very "let me in, i belong here" energy π«ΆTIFFNumberOfDirectories()β returns the number of directories in a file πTIFFNumberOfStrips()β returns the number of strips in an image π«TIFFNumberOfTiles()β returns the number of tiles in an image π§±TIFFOpen()β opens a file for reading or writing. the moment, the icon, the classic πTIFFOpenExt()β same deal, opens a file for reading or writing, except with options β stuff like re-entrant error and warning handlers may be passed in πTIFFOpenW()β opens a TIFF file with a Unicode filename, for read/writing πΈTIFFOpenWExt()β opens a TIFF file with a Unicode filename, for read/writing, and again with options, such as re-entrant error and warning handlers may be passed π¦TIFFOpenOptionsAlloc()β allocates memory for theTIFFOpenOptionsopaque structure. giving it room to breathe fr fr πTIFFOpenOptionsFree()β releases the allocated memory forTIFFOpenOptions. clean up after yourself bestie, it's giving responsible β¨TIFFOpenOptionsSetMaxSingleMemAlloc()β limits the maximum single memory allocation within libtiff. one big bite only πTIFFOpenOptionsSetMaxCumulatedMemAlloc()β limits the maximum cumulated memory allocation within libtiff. it's the total limit, not per-bite πTIFFOpenOptionsSetErrorHandlerExtR()β setup of a user-specific and per-TIFF handle (re-entrant) error handler πTIFFOpenOptionsSetWarningHandlerExtR()β setup of a user-specific and per-TIFF handle (re-entrant) warning handler πTIFFPrintDirectory()β prints out a description of the current directory πTIFFRasterScanlineSize()β returns the size in bytes of a complete decoded and packed raster scanline πTIFFRasterScanlineSize64()β same thing but it returns the size asuint64_tπ’TIFFRawStripSize()β returns the number of bytes in a raw strip π«TIFFRawStripSize64()β returns the number of bytes in a raw strip, asuint64_tπ’TIFFReadBufferSetup()β lets you specify the i/o buffer used for reading π§ΊTIFFReadCustomDirectory()β reads the custom directory from the given offset and sets the context of the TIFF-handletifto that custom directory π―TIFFReadDirectory()β reads the next directory πTIFFReadEncodedStrip()β reads a strip of data and decodes it, all in one goTIFFReadEncodedTile()β same energy, but for a tile of data π§©TIFFReadEXIFDirectory()β reads the EXIF directory sitting at the offset you hand it, and sets the context of the TIFF handletifto point at that EXIF directory πΈTIFFReadFromUserBuffer()β this one steps in forTIFFReadEncodedStrip()/TIFFReadEncodedTile()whenever you can supply the buffer for the input data πTIFFReadGPSDirectory()β reads the GPS directory at the given offset and sets the context of the TIFF handletifto that GPS directory πTIFFReadRawStrip()β reads a raw strip of data, no decoding, just vibesTIFFReadRawTile()β reads a raw tile of data, same deal π§±TIFFReadRGBAImage()β reads an image straight into a fixed-format raster β¨TIFFReadRGBAImageOriented()β literally does whatTIFFReadRGBAImage()does, except you get to pick the raster origin position πTIFFReadRGBAStrip()β reads one single strip of a strip-based image into memory, and drops the result into the RGBA raster you supplied yourself πTIFFReadRGBAStripExt()β identical toTIFFReadRGBAStrip()but it hands you thestop_on_errorparameter tooTIFFReadRGBATile()β reads one single tile of a tile-based image into memory, storing the result in your very own user-supplied RGBA raster π§©TIFFReadRGBATileExt()β same asTIFFReadRGBATile()but with thestop_on_errorparameter addedTIFFReadScanline()β reads one row of data and decodes it, line by line bestie β‘οΈTIFFReadTile()β reads and decodes a tile of dataTIFFRegisterCODEC()β lets you override the standard codec for one specific scheme πTIFFReverseBits()β flips all the bits in an array of bytes, little mirror moment πͺTIFFRewriteDirectory()β acts a lot likeTIFFWriteDirectory(), except you can call it on directories that were previously read or written and that already have an established location in the file, and it relocates that directory to the end of the file π¦TIFFRGBAImageBegin()β sets up the decoder state forTIFFRGBAImageGetTIFFRGBAImageEnd()β releases theTIFFRGBAImagedecoder state, clean up your room π§ΉTIFFRGBAImageGet()β reads and decodes an image πΌοΈTIFFRGBAImageOK()β tells you whether the image is even readable byTIFFRGBAImageGet(a little vibe check before you commit)TIFFScanlineSize()β returns the size of a scanline πTIFFScanlineSize64()β returns the size of a scanline as auint64_tTIFFSetClientdata()β sets the open file's clientdata (that's the file descriptor/handle) and returns the previous valueTIFFSetClientInfo()β adds or replaces an entry in the- (...picking up right where the last cell left off:)
clientinfo-list
TIFFSetCompressionScheme()β sets the compression scheme. choosing the vibe of how your pixels get squeezed πTIFFSetDirectory()β sets the current directory. like picking which room you're standing in πͺTIFFSetErrorHandler()β sets the error handler function. you're the one deciding who screams when stuff goes wrong πTIFFSetErrorHandlerExt()β same energy as above, but the error handler function takes a file handle as a parameter π«ΆTIFFSetField()β sets a tag's value in the current directory. the classic "write the thing" move β¨TIFFSetFileName()β sets the file name inside the TIFF-structure and returns the old file name. out with the old, in with the new πTIFFSetFileno()β overwrites a copy of the open file's I/O descriptor, and returns the previous value. (refer to the detailed description for the full tea, bestie) πTIFFSetMode()β sets the libtiff open mode in the TIFF-structure and returns the old mode πTIFFSetSubDirectory()β sets the current directory. yes it's giving dΓ©jΓ vu, they're cousins π¦TIFFSetTagExtender()β is used to register the merge function for user defined tags as an extender callback with libtiff. bring your own tags, we'll handle them πTIFFSetupStrips()β setups or resets strip parameters and strip array memory. a lil factory reset for your strips π§ΉTIFFSetWarningHandler()β sets the warning handler function. somebody's gotta say "hey, heads up" β οΈTIFFSetWarningHandlerExt()β the same, except the warning handler function takes a file handle as a parameter πTIFFSetWriteOffset()β sets the current write offset π
TIFFStripSize()β returns the size of a strip πTIFFStripSize64()β returns the equivalent size for a strip of data asuint64_t. big numbers only, no cap π₯
TIFFSwabArrayOfDouble()β swaps the bytes of an array of doubles πTIFFSwabArrayOfFloat()β swaps the bytes of an array of floats πTIFFSwabArrayOfLong()β swaps the bytes of an array of longs π«TIFFSwabArrayOfLong8()β swaps the bytes of an array ofuint64_tπTIFFSwabArrayOfShort()β swaps the bytes of an array of shorts βTIFFSwabArrayOfTriples()β swaps the first and third byte of each triple within an array of bytes. little byte glow-up, one triple at a time πTIFFSwabDouble()β swaps the bytes of a double πTIFFSwabFloat()β swaps the bytes of a float π¦TIFFSwabLong()β swaps the bytes of a long πΈTIFFSwabLong8()β swaps the bytes of a long long (uint64_t) πTIFFSwabShort()β swaps the bytes of a short β¨
TIFFTileRowSize()β returns the size of a row in a tile π§©TIFFTileRowSize64()β returns the size of a row in a tile asuint64_tπ’TIFFTileSize()β returns the size of a tile. that's the whole square, bestie, not just one row π
β¦and the list just keeps going bestie, because libtiff said "we contain multitudes" and meant it π
TIFFTileSize64()β hands you the size of a tile, but make ituint64_t(big number energy, no overflow tears) β¨TIFFUnlinkDirectory()β yanks the directory you point at clean out of the directory chain πTIFFUnRegisterCODEC()β unregisters that codec, it's done here, thank u next πTIFFUnsetField()β clears out the contents of the field in the internal structure, poof, gone πTIFFVGetField()β returns the tag value in the current directory (theva_listsibling ofTIFFGetField()) πTIFFVGetFieldDefaulted()β same vibe, returns the tag value in the current directory, but it'll hand you the default when nothing's been set π«ΆTIFFVSetField()β sets a tag's value in the current directory,va_liststyle ποΈTIFFVStripSize()β returns the number of bytes in a strip πTIFFVStripSize64()β returns the number of bytes in a strip withnrowsrows of data, as auint64_tπ’TIFFVTileSize()β returns the number of bytes in a row-aligned tile withnrowsof data π§©TIFFVTileSize64()β same row-aligned tile withnrowsof data, but the answer comes back as auint64_tnumber π«TIFFWarning()β the library-wide warning handling function, and it prints tostderrβ οΈTIFFWarningExt()β a user-specific library-wide warning handling function that you can pass a file handle to, which gets set to the open TIFF file inside libtiff πTIFFWarningExtR()β the user-specific, re-entrant library warning handling function, and it gets handed itsTIFFstructure, which contains the pointer to a user-specific data object πTIFFWriteBufferSetup()β sets up the data buffer used for writing raw (encoded) data out to a file π§ΊTIFFWriteCheck()β verify the file is writable and that the directory information is set up properly. It's the vibe check before you commit πTIFFWriteCustomDirectory()β writes the current custom directory (also EXIF or GPS) to file ποΈTIFFWriteDirectory()β writes the current directory. That's it, that's the whole job πTIFFWriteEncodedStrip()β compresses and writes a strip of data ποΈTIFFWriteEncodedTile()β compresses and writes a tile of data π§±TIFFWriteRawStrip()β writes a raw strip of data, no compression shenanigans π₯TIFFWriteRawTile()β writes a raw tile of data π§TIFFWriteScanline()β writes a scanline of data ποΈTIFFWriteTile()β compresses and writes a tile of data (yes, it's twins withTIFFWriteEncodedTile()up there, they're both iconic) πTIFFXYZToRGB()β performs the CIE XYZ to RGB conversion πTIFFYCbCrtoRGB()β performs the YCbCr to RGB conversion π¨TIFFYCbCrToRGBInit()β initializes the YCbCr to RGB conversion state, so the conversion above has somewhere to live π οΈ
π§° LIBTIFF AUXILIARY FUNCTIONS
okay so these are the auxiliary besties β the backstage crew π not the flashy main-character functions, but the ones keeping everything from imploding. here's the whole squad, no skips:
_TIFFCheckMalloc()β checks for integer overflow before it dynamically allocates a memory buffer. safety first, always π_TIFFCheckRealloc()β same energy, but the overflow check happens before it dynamically reallocates a memory buffer._TIFFClampDoubleToUInt32()β clampsdoublevalues into the range ofuint32_t, i.e.0 .. 0xFFFFFFFF. no escaping the box, bestie π_TIFFfree()β free a memory buffer. bye girl π_TIFFGetExifFields()β returns a pointer to the libtiff internal definition list of the EXIF tags._TIFFGetGpsFields()β returns a pointer to the libtiff internal definition list of the GPS tags. yes, the location ones πΊοΈ_TIFFmalloc()β dynamically allocate a memory buffer._TIFFmemcmp()β compares the contents of memory buffers._TIFFmemcpy()β copies the contents of one buffer to another._TIFFmemset()β fills a memory buffer with a constant byte._TIFFMultiply32()β checks for an integer overflow of the multiplication result ofuint32_t, and returns the multiplication result, or0if an overflow would happen._TIFFMultiply64()β same thing but the multiplication result ofuint64_t, and again returns the multiplication result, or0if an overflow would happen._TIFFrealloc()β dynamically reallocate a memory buffer._TIFFRewriteField()β rewrites a field in the directory on disk without regard to updating the TIFF directory structure in memory. that's it, that's the whole description. it does not touch the in-memory copy, fr fr π
π·οΈ TAG USAGE
want the receipts on which TIFF tags the library actually recognizes? for a table of TIFF tags recognized by the library, refer to LibTIFF Coverage of the TIFF 6.0 Specification β¨ go read it, it's giving very thorough.
π§ PSEUDO TAGS
okay so this is the fun part π
in addition to the normal TIFF tags, the library supports a whole collection of tags whose values lie in a range outside the valid range of TIFF tags. these are termed pseudo-tags, and they're used to control various codec-specific functions within the library. think of them as the secret menu items β not real TIFF tags, but the library understands them π«Ά
the table below summarizes the defined pseudo-tags.
β¦and that table is right where we're headed next, so don't you dare close the tab π
π LIBTIFF SUPPORTED TAGS π
okay bestie, here's the tea on which tags are actually supported, who reads and writes them, and what they do π«Ά every single one of these is R/W (read and write), no cap:
TIFFTAG_FAXMODEβ codec:G3Β· R/W Β· general codec operationTIFFTAG_FAXFILLFUNCβ codec:G3/G4Β· R/W Β· bitmap fill functionTIFFTAG_JPEGQUALITYβ codec:JPEGΒ· R/W Β· compression quality controlTIFFTAG_JPEGCOLORMODEβ codec:JPEGΒ· R/W Β· control colorspace conversionsTIFFTAG_JPEGTABLESMODEβ codec:JPEGΒ· R/W Β· control contents ofJPEGTablestagTIFFTAG_ZIPQUALITYβ codec:DeflateΒ· R/W Β· compression quality levelTIFFTAG_PIXARLOGDATAFMTβ codec:PixarLogΒ· R/W Β· user data formatTIFFTAG_PIXARLOGQUALITYβ codec:PixarLogΒ· R/W Β· compression quality levelTIFFTAG_SGILOGDATAFMTβ codec:SGILogΒ· R/W Β· user data format
TIFFTAG_FAXMODE ποΈ
Controls how the Group 3 codec operates. The possible values are independent bits, so you can combine them by or'ing them together:
FAXMODE_CLASSICβ enable old-style format in which the RTC is written at the end of the last stripFAXMODE_NORTCβ the opposite ofFAXMODE_CLASSIC; also calledFAXMODE_CLASSFFAXMODE_NOEOLβ do not write EOL codes at the start of each row of dataFAXMODE_BYTEALIGNβ align each encoded row to an 8-bit boundaryFAXMODE_WORDALIGNβ align each encoded row to an 16-bit boundary
The default value is dependent on the compression scheme; this pseudo-tag is used by the various G3 and G4 codecs to share code. π
TIFFTAG_FAXFILLFUNC ποΈ
Controls the function used to convert arrays of black and white runs to packed bit arrays. This hook can be used to image decoded scanlines in multi-bit depth rasters (e.g. for display in colormap mode) or for other purposes. The default value is a pointer to a builtin function that images packed bilevel data.
TIFFTAG_IPTCNEWSPHOTO π°
This tag contains image metadata per the IPTC newsphoto spec: Headline, captioning, credit, etc... Used by most wire services.
TIFFTAG_PHOTOSHOP π¨
This tag contains Photoshop captioning information and metadata. Photoshop uses in parallel and redundantly alongside IPTCNEWSPHOTO information.
TIFFTAG_JPEGQUALITY πΈ
Controls the compression quality level used in the baseline algorithm. Note that quality levels are in the range 0-100 with a default value of 75.
TIFFTAG_JPEGCOLORMODE π
Controls whether or not conversion is done between RGB and YCbCr colorspaces. Possible values are:
JPEGCOLORMODE_RAWβ do not convert, andJPEGCOLORMODE_RGBβ convert to/from RGB
The default value is JPEGCOLORMODE_RAW.
TIFFTAG_JPEGTABLESMODE ποΈ
Controls the information written in the JPEGTables tag. Possible values are independent bits that can be combined by or'ing them together:
JPEGTABLESMODE_QUANTβ include quantization tables, andJPEGTABLESMODE_HUFFβ include Huffman encoding tables.
The default value is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF.
TIFFTAG_ZIPQUALITY ποΈ
Controls the compression technique used by the Deflate codec. Quality levels are in the range 1-9, with larger numbers yielding better compression at the cost of more computation. The default quality level is 6, which yields a good time-space tradeoff. (iconic behavior honestly β¨)
TIFFTAG_PIXARLOGDATAFMT π§
Controls the format of user data passed in to the PixarLog codec when encoding and passed out from when decoding. Possible values are:
PIXARLOGDATAFMT_8BITβ for 8-bit unsigned pixelsPIXARLOGDATAFMT_8BITABGRβ for 8-bit unsigned ABGR-ordered pixelsPIXARLOGDATAFMT_11BITLOGβ for 11-bit log-encoded raw dataPIXARLOGDATAFMT_12BITPICIOβ for 12-bit PICIO-compatible dataPIXARLOGDATAFMT_16BITβ for 16-bit signed samples, andPIXARLOGDATAFMT_FLOATβ for 32-bit IEEE floating point samples.
TIFFTAG_PIXARLOGQUALITY π₯
Controls the compression technique used by the PixarLog codec. This value is treated identically to TIFFTAG_ZIPQUALITY; see the above description.
TIFFTAG_SGILOGDATAFMT πΈ
Controls the format of client data passed in to the SGILog codec when encoding and passed out from when decoding. Possible values are:
SGILOGDATAFMT_FLTXYZβ for converting between LogLuv and 32-bit IEEE floating valued XYZ pixelsSGILOGDATAFMT_16BITLUVβ for 16-bit encoded Luv pixelsSGILOGDATAFMT_32BITRAW,SGILOGDATAFMT_24BITRAWβ for no conversion of dataSGILOGDATAFMT_8BITRGBβ for returning 8-bit RGB data (valid only when decoding LogLuv-encoded data)SGILOGDATAFMT_FLTYβ for converting between LogL and 32-bit IEEE floating valued Y pixelsSGILOGDATAFMT_16BITLβ for 16-bit encoded L pixels, andSGILOGDATAFMT_8BITGRYβ for returning 8-bit greyscale data (valid only when decoding LogL-encoded data).
β¨ DIAGNOSTICS β¨
All error messages are directed through the TIFFErrorExtR() routine. By default, messages are directed to stderr in the form:
module: message\n
Warning messages are likewise directed through the TIFFWarningExtR() routine. π«Ά
π SEE ALSO π
fax2tiff, pal2rgb, ppm2tiff, rgb2ycbcr, raw2tiff, tiff2bw, tiffdither, tiffdump, tiffcp, tiffcmp, tiffgt, tiffinfo, tiffmedian, tiffsplit,
"Tag Image File Format Specification Revision 6.0", an Aldus Technical Memorandum.
"The Spirit of TIFF Class F", an appendix to the TIFF 5.0 specification prepared by Cygnet Technologies.
π BUGS π
- The library does not support multi-sample images where some samples have different bits/sample.
- The library does not support random access to compressed data that is organized with more than one row per tile or strip.
not me listing the Ls, but fr fr these are real limitations so don't come for the library when they bite you π
π«Ά AUTHOR π«Ά
LibTIFF contributors
π COPYRIGHT π
1988-2025, LibTIFF contributors
and that's a wrap bestie!! this whole thing was LibTIFF version 4.7, dated Jun 27, 2026, aka LIBTIFF(3tiff) β go forth and tag your TIFFs responsibly πβ¨ slay, periodt, bye π¦
π¦ where this page comes from
- fedora 43: libtiff-devel 4.7.2-1.fc43
- fedora 43: libtiff-devel 4.7.2-1.fc43
- fedora 43: libtiff-devel 4.7.2-3.fc43 Β· libtiff
- fedora 43: libtiff-devel 4.7.2-3.fc43 Β· libtiff
- fedora 44: libtiff-devel 4.7.2-1.fc44
- fedora 44: libtiff-devel 4.7.2-1.fc44
- fedora 44: libtiff-devel 4.7.2-3.fc44 Β· libtiff
- fedora 44: libtiff-devel 4.7.2-3.fc44 Β· libtiff
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms