91#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
130#if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && \
131 !defined(USE_WIN32_FILEIO)
136#define AVOID_WIN32_FILEIO
140#if defined(USE_WIN32_FILEIO)
180#define TIFFPRINT_NONE 0x0
190#define TIFFPRINT_STRIPS 0x1
199#define TIFFPRINT_CURVES 0x2
209#define TIFFPRINT_COLORMAP 0x4
216#define TIFFPRINT_JPEGQTABLES 0x100
224#define TIFFPRINT_JPEGACTABLES 0x200
232#define TIFFPRINT_JPEGDCTABLES 0x200
243#define D65_X0 (95.0470f)
248#define D65_Y0 (100.0f)
253#define D65_Z0 (108.8827f)
259#define D50_X0 (96.4250f)
264#define D50_Y0 (100.0f)
269#define D50_Z0 (82.4680f)
370#define CIELABTORGB_TABLE_RANGE 1500
454 uint32_t y, uint32_t w, uint32_t h,
455 int32_t fromskew, int32_t toskew,
497 uint32_t x, uint32_t y, uint32_t w,
498 uint32_t h, int32_t fromskew,
499 int32_t toskew,
unsigned char *r,
500 unsigned char *g,
unsigned char *b,
634#define TIFFGetR(abgr) ((abgr) & 0xff)
646#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)
658#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)
670#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)
748#define LOGLUV_PUBLIC 1
761#if defined(__GNUC__) || defined(__clang__) || defined(__attribute__)
762#define TIFF_ATTRIBUTE(x) __attribute__(x)
764#define TIFF_ATTRIBUTE(x)
784#if defined(__has_attribute)
785#if __has_attribute(__malloc__)
786#define TIFF_ATTRIBUTE_MALLOC __attribute__((__malloc__))
788#if __has_attribute(__alloc_size__)
789#define TIFF_ATTRIBUTE_ALLOC_SIZE(n) __attribute__((__alloc_size__(n)))
790#define TIFF_ATTRIBUTE_ALLOC_SIZE2(n, m) __attribute__((__alloc_size__(n, m)))
795#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && \
796 !defined(__NVCOMPILER)
798#define TIFF_ATTRIBUTE_DEALLOC(f, n) __attribute__((__malloc__(f, n)))
801#ifndef TIFF_ATTRIBUTE_MALLOC
802#define TIFF_ATTRIBUTE_MALLOC
804#ifndef TIFF_ATTRIBUTE_ALLOC_SIZE
805#define TIFF_ATTRIBUTE_ALLOC_SIZE(n)
806#define TIFF_ATTRIBUTE_ALLOC_SIZE2(n, m)
808#ifndef TIFF_ATTRIBUTE_DEALLOC
809#define TIFF_ATTRIBUTE_DEALLOC(f, n)
812#if defined(c_plusplus) || defined(__cplusplus)
859 const char *fmt, va_list ap);
885 const char *module,
const char *fmt,
1140#ifndef TIFF_DO_NOT_USE_NON_EXT_ALLOC_FUNCTIONS
1170 TIFF_ATTRIBUTE_ALLOC_SIZE(1) TIFF_ATTRIBUTE_DEALLOC(
_TIFFfree, 1);
1188 TIFF_ATTRIBUTE_ALLOC_SIZE2(1, 2) TIFF_ATTRIBUTE_DEALLOC(
_TIFFfree, 1);
1289#define TIFF_ANY TIFF_NOTYPE
1297#define TIFF_VARIABLE -1
1310#define TIFF_VARIABLE2 -3
1316#define FIELD_CUSTOM 65
1386 const char *field_name);
3296#if defined(c_plusplus) || defined(__cplusplus)
3299 uint16_t sample = 0);
3301 uint16_t sample = 0);
3436 uint32_t *raster,
int stop);
3466 uint32_t rheight, uint32_t *raster,
3467 int orientation,
int stop);
3582 uint32_t *raster,
int stop_on_error);
3667 uint32_t rwidth, uint32_t rheight);
3740 extern void TIFFError(
const char *module,
const char *fmt, ...)
3790 extern
void TIFFWarning(const
char *module, const
char *fmt, ...)
3816 const
char *fmt, ...)
4045 int warn_about_unknown_tags);
4073 void *errorhandler_user_data);
4101 void *warnhandler_user_data);
4125 extern
TIFF *
TIFFOpen(const
char *name, const
char *mode);
4161 extern TIFF *
TIFFOpenW(
const wchar_t *name,
const char *mode);
4193 extern TIFF *
TIFFFdOpen(
int fd,
const char *name,
const char *mode);
4370 uint32_t z, uint16_t s);
4442 uint32_t z, uint16_t s);
4476 uint32_t z, uint16_t s);
5168#define U_NEU 0.210526316
5173#define V_NEU 0.473684211
5223 extern void XYZtoRGB24(
float *xyz, uint8_t *rgb);
5239 extern int uv_decode(
double *up,
double *vp,
int c);
5274#if defined(c_plusplus) || defined(__cplusplus)
5348 extern int uv_encode(
double u,
double v,
int em);
5443 int32_t b,
float *X,
float *Y,
float *Z);
5467 uint32_t *r, uint32_t *g, uint32_t *b);
5491 float *refBlackWhite);
5511 int32_t Cr, uint32_t *r, uint32_t *g,
5588#if defined(c_plusplus) || defined(__cplusplus)
void TIFFSetClientInfo(TIFF *tif, void *data, const char *name)
Add or replace a handle-local named borrowed payload.
void * TIFFGetClientInfo(TIFF *tif, const char *name)
Look up a borrowed payload by its handle-local name.
TIFFCodec * TIFFRegisterCODEC(uint16_t scheme, const char *name, TIFFInitMethod init)
Register a codec descriptor ahead of built-in and older entries.
const TIFFCodec * TIFFFindCODEC(uint16_t scheme)
Find the highest-priority descriptor for a compression scheme.
int(* TIFFInitMethod)(TIFF *tif, int scheme)
Install compression methods and private state on a handle.
int TIFFIsCODECConfigured(uint16_t scheme)
Check whether the selected descriptor has a configured initialiser.
TIFFCodec * TIFFGetConfiguredCODECs(void)
Allocate a terminated snapshot of registered and configured codec descriptors.
void TIFFUnRegisterCODEC(TIFFCodec *c)
Remove and free an exact registered codec descriptor.
#define TIFF_SSIZE_T
Define the signed addressing-size type used for tmsize_t.
void TIFFSwabArrayOfLong8(uint64_t *lp, tmsize_t n)
Reverse the byte order of each array element.
void TIFFSwabFloat(float *fp)
Reverse the byte order of one value.
void TIFFCIELabToXYZ(TIFFCIELabToRGB *cielab, uint32_t l, int32_t a, int32_t b, float *X, float *Y, float *Z)
Convert 8-bit TIFF CIE L*a*b* samples to XYZ.
void TIFFSwabDouble(double *dp)
Reverse the byte order of one value.
void TIFFSwabArrayOfTriples(uint8_t *tp, tmsize_t n)
Reverse the byte order of each array element.
void TIFFSwabArrayOfDouble(double *dp, tmsize_t n)
Reverse the byte order of each array element.
void TIFFSwabArrayOfShort(uint16_t *wp, tmsize_t n)
Reverse the byte order of each array element.
void TIFFSwabLong8(uint64_t *lp)
Reverse the byte order of one value.
void TIFFSwabShort(uint16_t *wp)
Reverse the byte order of one value.
void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *ycbcr, uint32_t Y, int32_t Cb, int32_t Cr, uint32_t *r, uint32_t *g, uint32_t *b)
Convert an 8-bit YCbCr sample triplet to clipped RGB.
const unsigned char * TIFFGetBitRevTable(int reversed)
Select the immutable byte reversal or identity lookup table.
void TIFFSwabArrayOfLong(uint32_t *lp, tmsize_t n)
Reverse the byte order of each array element.
int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB *ycbcr, float *luma, float *refBlackWhite)
Initialise caller-allocated 8-bit YCbCr conversion tables.
void TIFFReverseBits(uint8_t *cp, tmsize_t n)
Reverse the bit order within each byte of a buffer.
int TIFFCIELabToRGBInit(TIFFCIELabToRGB *cielab, const TIFFDisplay *display, float *refWhite)
Initialise caller-owned CIE Lab conversion tables and reference white.
void TIFFSwabLong(uint32_t *lp)
Reverse the byte order of one value.
void TIFFSwabArrayOfFloat(float *fp, tmsize_t n)
Reverse the byte order of each array element.
void TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z, uint32_t *r, uint32_t *g, uint32_t *b)
Convert XYZ tristimulus values to display RGB channels.
#define TIFF_ATTRIBUTE(x)
Expand a compiler attribute in a public declaration when supported.
unsigned char TIFFRGBValue
Represent an 8-bit RGB channel value.
#define CIELABTORGB_TABLE_RANGE
Define the largest CIE L*a*b*-to-RGB lookup-table index.
void(* TIFFErrorHandlerExt)(thandle_t fd, const char *module, const char *fmt, va_list ap)
Handle a library-wide error or warning diagnostic.
TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt handler)
Replace the library-wide error extended handler.
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Dispatch a error diagnostic to the configured handlers.
void TIFFWarningExtR(TIFF *tif, const char *module, const char *fmt,...)
Dispatch a warning diagnostic to the configured handlers.
void TIFFWarningExt(thandle_t fd, const char *module, const char *fmt,...)
Dispatch a warning diagnostic to the configured handlers.
void TIFFWarning(const char *module, const char *fmt,...)
Dispatch a warning diagnostic to the configured handlers.
TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt handler)
Replace the library-wide warning extended handler.
void TIFFError(const char *module, const char *fmt,...)
Dispatch a error diagnostic to the configured handlers.
void(* TIFFErrorHandler)(const char *module, const char *fmt, va_list ap)
Handle a library-wide error or warning diagnostic.
TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler handler)
Replace the library-wide error handler.
TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler handler)
Replace the library-wide warning handler.
void TIFFErrorExtR(TIFF *tif, const char *module, const char *fmt,...)
Dispatch a error diagnostic to the configured handlers.
tdir_t TIFFNumberOfDirectories(TIFF *tif)
Count reachable main-chain directories from the cached file header.
int TIFFSetSubDirectory(TIFF *tif, uint64_t diroff)
Select and read an image directory at a file offset.
void TIFFFreeDirectory(TIFF *tif)
Release the current directory's owned values and codec state.
int TIFFLastDirectory(TIFF *tif)
Test whether the cached next-directory link is zero.
int TIFFCreateGPSDirectory(TIFF *tif)
Create a fresh in-memory EXIF GPS metadata directory.
tdir_t TIFFCurrentDirectory(TIFF *tif)
Read the cached index of the current directory.
int TIFFSetDirectory(TIFF *tif, tdir_t dirn)
Select and read an image directory by its main-chain index.
int TIFFUnlinkDirectory(TIFF *tif, tdir_t dirn)
Remove an image directory from the on-file main chain.
int TIFFCreateDirectory(TIFF *tif)
Replace current values with a fresh in-memory image directory.
int TIFFCreateCustomDirectory(TIFF *tif, const TIFFFieldArray *infoarray)
Replace current values with a fresh custom metadata directory.
int TIFFCreateEXIFDirectory(TIFF *tif)
Create a fresh in-memory EXIF metadata directory.
uint64_t TIFFCurrentDirOffset(TIFF *tif)
Read the cached file offset of the current directory.
void TIFFPrintDirectory(TIFF *tif, FILE *fd, long flags)
Print a human-readable description of the current directory.
uint32_t TIFFGetTagListEntry(TIFF *tif, int tag_index)
Look up a tag number by its custom-value list index.
int TIFFFieldIsAnonymous(const TIFFField *fip)
Test whether a field was registered as an unknown tag.
const TIFFField * TIFFFieldWithTag(TIFF *tif, uint32_t tag)
Find a registered field by tag number.
int TIFFDataWidth(TIFFDataType type)
Report the on-disk byte width of a TIFF data type.
int TIFFMergeFieldInfo(TIFF *tif, const TIFFFieldInfo info[], uint32_t n)
Register legacy application field definitions on a handle.
const TIFFField * TIFFFieldWithName(TIFF *tif, const char *field_name)
Find a registered field by name.
int TIFFFieldReadCount(const TIFFField *fip)
Read a field descriptor's getter count rule.
void(* TIFFExtendProc)(TIFF *tif)
Extend the image-directory field table during default initialisation.
TIFFDataType TIFFFieldDataType(const TIFFField *fip)
Read a field descriptor's on-disk data type.
int TIFFFieldWriteCount(const TIFFField *fip)
Read a field descriptor's setter count rule.
uint32_t TIFFFieldTag(const TIFFField *fip)
Read a field descriptor's tag number.
int TIFFGetTagListCount(TIFF *tif)
Count values stored in the current custom-tag list.
TIFFTagMethods * TIFFAccessTagMethods(TIFF *tif)
Expose a handle's mutable tag-method table.
const TIFFField * TIFFFindField(TIFF *tif, uint32_t tag, TIFFDataType dt)
Find a registered field by tag number and file data type.
int TIFFFieldPassCount(const TIFFField *fip)
Test whether a field passes an explicit count argument.
const char * TIFFFieldName(const TIFFField *fip)
Read a field descriptor's name.
TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc extender)
Replace the process-wide image-directory extension callback.
int TIFFFieldSetGetCountSize(const TIFFField *fip)
Report the count width encoded by a field's set/get representation.
int TIFFFieldSetGetSize(const TIFFField *fip)
Report the internal element storage width of a field.
int TIFFReadCustomDirectory(TIFF *tif, toff_t diroff, const TIFFFieldArray *infoarray)
Read metadata using an explicit custom field schema.
int TIFFReadGPSDirectory(TIFF *tif, toff_t diroff)
Read a EXIF GPS metadata directory.
int TIFFReadEXIFDirectory(TIFF *tif, toff_t diroff)
Read a EXIF metadata directory.
int TIFFReadDirectory(TIFF *tif)
Read and install the next image directory.
int TIFFCheckpointDirectory(TIFF *tif)
Write the current image directory while retaining its values.
int TIFFForceStrileArrayWriting(TIFF *tif)
Patch on-file strile offset and byte-count payloads.
int TIFFRewriteDirectory(TIFF *tif)
Relocate the current image IFD and repair its main-chain link.
int TIFFDeferStrileArrayWriting(TIFF *tif)
Reserve strile-array entries for deferred payload writing.
int TIFFWriteDirectory(TIFF *tif)
Finish the current image directory and prepare a fresh one.
int TIFFWriteCustomDirectory(TIFF *tif, uint64_t *pdiroff)
Write current custom values and return their IFD offset.
int TIFFReadBufferSetup(TIFF *tif, void *bp, tmsize_t size)
Replace the handle's raw reading buffer.
uint64_t TIFFGetMaxCompressionRatio(TIFF *tif)
Query the codec's allocation-recovery compression-ratio heuristic.
int TIFFWriteBufferSetup(TIFF *tif, void *bp, tmsize_t size)
Replace the handle's encoding buffer.
int TIFFWriteCheck(TIFF *tif, int tiles, const char *module)
Validate and prepare geometry for image writing.
int TIFFSetupStrips(TIFF *tif)
Replace strile offset/count arrays from current geometry.
tmsize_t TIFFTileSize(TIFF *tif)
Compute the decoded-size estimate for the configured tile height.
tmsize_t TIFFStripSize(TIFF *tif)
Compute the decoded-size estimate for a nominal strip.
uint64_t TIFFRawStripSize64(TIFF *tif, uint32_t strip)
Query the stored byte count for one raw strip.
tmsize_t TIFFScanlineSize(TIFF *tif)
Compute the current scanline I/O byte estimate.
tmsize_t TIFFVStripSize(TIFF *tif, uint32_t nrows)
Compute the decoded-size estimate for a requested strip height.
uint64_t TIFFVTileSize64(TIFF *tif, uint32_t nrows)
Compute the decoded-size estimate for a requested tile height.
uint64_t TIFFScanlineSize64(TIFF *tif)
Compute the current scanline I/O byte estimate.
uint32_t TIFFNumberOfStrips(TIFF *tif)
Compute the strip count from current image geometry.
tmsize_t TIFFTileRowSize(TIFF *tif)
Compute the packed byte count of one tile row.
uint32_t TIFFComputeStrip(TIFF *tif, uint32_t row, uint16_t sample)
Compute a strip index from a row and optional sample plane.
uint64_t TIFFVStripSize64(TIFF *tif, uint32_t nrows)
Compute the decoded-size estimate for a requested strip height.
uint32_t TIFFCurrentTile(TIFF *tif)
Read the cached current tile index.
uint64_t TIFFTileSize64(TIFF *tif)
Compute the decoded-size estimate for the configured tile height.
tmsize_t TIFFVTileSize(TIFF *tif, uint32_t nrows)
Compute the decoded-size estimate for a requested tile height.
tmsize_t TIFFRawStripSize(TIFF *tif, uint32_t strip)
Convert one raw-strip byte count to the legacy signed-size result.
uint32_t TIFFCurrentRow(TIFF *tif)
Read the cached current scanline index.
uint32_t TIFFComputeTile(TIFF *tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s)
Compute a tile index from pixel and sample coordinates.
int TIFFCheckTile(TIFF *tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s)
Check pixel and separate-sample coordinates against image bounds.
uint64_t TIFFStripSize64(TIFF *tif)
Compute the decoded-size estimate for a nominal strip.
uint32_t TIFFDefaultStripSize(TIFF *tif, uint32_t request)
Ask the installed sizing method for a RowsPerStrip recommendation.
uint32_t TIFFNumberOfTiles(TIFF *tif)
Compute the tile count across image depth and sample planes.
void TIFFDefaultTileSize(TIFF *tif, uint32_t *tw, uint32_t *th)
Ask the installed sizing method to adjust tile width and height.
uint64_t TIFFRasterScanlineSize64(TIFF *tif)
Compute the packed full-raster row byte count.
uint64_t TIFFTileRowSize64(TIFF *tif)
Compute the packed byte count of one tile row.
tmsize_t TIFFRasterScanlineSize(TIFF *tif)
Compute the packed full-raster row byte count.
uint32_t TIFFCurrentStrip(TIFF *tif)
Read the cached current strip index.
int TIFFReadScanline(TIFF *tif, void *buf, uint32_t row, uint16_t sample)
Decode one image scanline into caller storage.
int TIFFReadFromUserBuffer(TIFF *tif, uint32_t strile, void *inbuf, tmsize_t insize, void *outbuf, tmsize_t outsize)
Decode one strile from caller-provided stored bytes.
tmsize_t TIFFReadRawStrip(TIFF *tif, uint32_t strip, void *buf, tmsize_t size)
Read stored bytes from one strip.
tmsize_t TIFFReadRawTile(TIFF *tif, uint32_t tile, void *buf, tmsize_t size)
Read stored bytes from one tile.
tmsize_t TIFFReadEncodedStrip(TIFF *tif, uint32_t strip, void *buf, tmsize_t size)
Read decoded samples from one strip.
tmsize_t TIFFReadTile(TIFF *tif, void *buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s)
Decode the tile containing image coordinates.
tmsize_t TIFFReadEncodedTile(TIFF *tif, uint32_t tile, void *buf, tmsize_t size)
Read decoded samples from one tile.
tmsize_t TIFFWriteRawTile(TIFF *tif, uint32_t tile, void *data, tmsize_t cc)
Write raw stored bytes to one tile.
tmsize_t TIFFWriteRawStrip(TIFF *tif, uint32_t strip, void *data, tmsize_t cc)
Write raw stored bytes to one strip.
void TIFFSetWriteOffset(TIFF *tif, toff_t off)
Change the cached next payload write offset.
int TIFFWriteScanline(TIFF *tif, void *buf, uint32_t row, uint16_t sample)
Encode and buffer one image scanline.
tmsize_t TIFFWriteEncodedTile(TIFF *tif, uint32_t tile, void *data, tmsize_t cc)
Write encoded samples to one tile.
tmsize_t TIFFWriteTile(TIFF *tif, void *buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s)
Encode the tile containing image coordinates.
tmsize_t TIFFWriteEncodedStrip(TIFF *tif, uint32_t strip, void *data, tmsize_t cc)
Write encoded samples to one strip.
toff_t(* TIFFSeekProc)(thandle_t fd, toff_t off, int whence)
Change the current position of a client I/O resource.
int(* TIFFCloseProc)(thandle_t fd)
Release a client I/O resource or its adapter context.
void(* TIFFUnmapFileProc)(thandle_t fd, void *base, toff_t size)
Release a whole-file view supplied by a mapping callback.
toff_t(* TIFFSizeProc)(thandle_t fd)
Query the byte length of a client I/O resource.
tmsize_t(* TIFFReadWriteProc)(thandle_t fd, void *buf, tmsize_t size)
Transfer bytes at the current position of a client I/O resource.
int(* TIFFMapFileProc)(thandle_t fd, void **base, toff_t *size)
Provide a readable whole-file view of a client resource.
int TIFFGetMode(TIFF *tif)
Return the stored library access mode.
int TIFFFileno(TIFF *tif)
Return the handle's file-descriptor metadata.
TIFF * TIFFClientOpenExt(const char *name, const char *mode, thandle_t clientdata, TIFFReadWriteProc readproc, TIFFReadWriteProc writeproc, TIFFSeekProc seekproc, TIFFCloseProc closeproc, TIFFSizeProc sizeproc, TIFFMapFileProc mapproc, TIFFUnmapFileProc unmapproc, TIFFOpenOptions *opts)
Initialise a TIFF handle using client-supplied I/O callbacks.
TIFF * TIFFClientOpen(const char *name, const char *mode, thandle_t clientdata, TIFFReadWriteProc readproc, TIFFReadWriteProc writeproc, TIFFSeekProc seekproc, TIFFCloseProc closeproc, TIFFSizeProc sizeproc, TIFFMapFileProc mapproc, TIFFUnmapFileProc unmapproc)
Initialise a TIFF handle using client-supplied I/O callbacks.
TIFFReadWriteProc TIFFGetReadProc(TIFF *tif)
Return the installed client read callback.
int TIFFSetFileno(TIFF *tif, int fd)
Replace descriptor metadata without changing client I/O routing.
TIFF * TIFFOpenExt(const char *name, const char *mode, TIFFOpenOptions *opts)
Open a TIFF file by pathname.
TIFFCloseProc TIFFGetCloseProc(TIFF *tif)
Return the installed client close callback.
const char * TIFFFileName(TIFF *tif)
Return the handle's diagnostic filename.
TIFF * TIFFFdOpenExt(int fd, const char *name, const char *mode, TIFFOpenOptions *opts)
Attach a TIFF handle to an already-open platform resource.
TIFFSizeProc TIFFGetSizeProc(TIFF *tif)
Return the installed client file-size callback.
TIFF * TIFFOpen(const char *name, const char *mode)
Open a TIFF file by pathname.
int TIFFSetMode(TIFF *tif, int mode)
Replace the stored library access mode without reopening the resource.
int TIFFFlushData(TIFF *tif)
Flush pending encoded image data without committing directory changes.
int TIFFIsMSB2LSB(TIFF *tif)
Test the selected data bit-fill-order flag.
void TIFFClose(TIFF *tif)
Release a TIFF handle and invoke its client close callback.
int TIFFIsByteSwapped(TIFF *tif)
Test whether file values require byte swapping for this host.
TIFFMapFileProc TIFFGetMapFileProc(TIFF *tif)
Return the installed client mapping callback.
int TIFFFlush(TIFF *tif)
Flush pending image data and dirty directory information.
TIFF * TIFFOpenW(const wchar_t *name, const char *mode)
Open a TIFF file using a wide Windows pathname.
int TIFFIsTiled(TIFF *tif)
Test whether the current image uses tiles.
const char * TIFFSetFileName(TIFF *tif, const char *name)
Replace the diagnostic filename pointer without copying it.
TIFF * TIFFFdOpen(int fd, const char *name, const char *mode)
Attach a TIFF handle to an already-open platform resource.
void TIFFCleanup(TIFF *tif)
Release library state without invoking the client close callback.
TIFFSeekProc TIFFGetSeekProc(TIFF *tif)
Return the installed client seek callback.
int TIFFIsBigTIFF(TIFF *tif)
Test whether the handle uses the BigTIFF format.
thandle_t TIFFSetClientdata(TIFF *tif, thandle_t newvalue)
Replace the context passed to all client I/O callbacks.
TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF *tif)
Return the installed client unmapping callback.
int TIFFIsBigEndian(TIFF *tif)
Test whether the stored file signature is TIFF_BIGENDIAN.
int TIFFIsUpSampled(TIFF *tif)
Test whether the active codec supplies upsampled data.
TIFFReadWriteProc TIFFGetWriteProc(TIFF *tif)
Return the installed client write callback.
thandle_t TIFFClientdata(TIFF *tif)
Return the context passed to client I/O callbacks.
TIFF * TIFFOpenWExt(const wchar_t *name, const char *mode, TIFFOpenOptions *opts)
Open a TIFF file using a wide Windows pathname.
int LogL10fromY(double Y, int em)
Encode linear luminance as a 10-bit logarithmic value.
int uv_decode(double *up, double *vp, int c)
Decode a quantised chromaticity index to a bin-centre pair.
void LogLuv32toXYZ(uint32_t p, float *XYZ)
Decode one packed 32-bit LogLuv pixel to linear XYZ.
double LogL10toY(int p10)
Decode 10-bit logarithmic luminance to a linear value.
int LogL16fromY(double Y, int em)
Encode linear luminance as a 16-bit logarithmic value.
void XYZtoRGB24(float *xyz, uint8_t *rgb)
Convert a linear XYZ triplet to display RGB bytes.
void LogLuv24toXYZ(uint32_t p, float *XYZ)
Decode one packed 24-bit LogLuv pixel to linear XYZ.
uint32_t LogLuv32fromXYZ(float *XYZ, int em)
Encode linear XYZ as one packed 32-bit LogLuv pixel.
uint32_t LogLuv24fromXYZ(float *XYZ, int em)
Encode linear XYZ as one packed 24-bit LogLuv pixel.
double LogL16toY(int p16)
Decode 16-bit logarithmic luminance to a linear value.
int uv_encode(double u, double v, int em)
Encode chromaticity using the irregular LogLuv quantisation table.
void _TIFFfree(void *p)
Release a block allocated by the public allocation family.
void * _TIFFcalloc(tmsize_t nmemb, tmsize_t siz)
Allocate a zero-filled array through the public allocator.
void _TIFFmemset(void *p, int v, tmsize_t c)
Fill a byte range with one repeated byte.
void * _TIFFmalloc(tmsize_t s)
Allocate an uninitialised block through the public allocator.
int _TIFFmemcmp(const void *p1, const void *p2, tmsize_t c)
Compare two byte ranges lexicographically.
void _TIFFmemcpy(void *d, const void *s, tmsize_t c)
Copy a non-overlapping byte range.
void * _TIFFrealloc(void *p, tmsize_t s)
Resize a public-allocator block using platform realloc semantics.
void TIFFOpenOptionsSetWarningHandlerExtR(TIFFOpenOptions *opts, TIFFErrorHandlerExtR handler, void *warnhandler_user_data)
Set the per-handle warning callback for subsequent opens.
void TIFFOpenOptionsSetErrorHandlerExtR(TIFFOpenOptions *opts, TIFFErrorHandlerExtR handler, void *errorhandler_user_data)
Set the per-handle error callback for subsequent opens.
void TIFFOpenOptionsSetMaxCumulatedMemAlloc(TIFFOpenOptions *opts, tmsize_t max_cumulated_mem_alloc)
Set the cumulative checked allocation limit for subsequent opens.
void TIFFOpenOptionsSetWarnAboutUnknownTags(TIFFOpenOptions *opts, int warn_about_unknown_tags)
Select whether subsequent opens warn about unknown tags.
int(* TIFFErrorHandlerExtR)(TIFF *tif, void *user_data, const char *module, const char *fmt, va_list ap)
Handle a diagnostic using a per-handle borrowed context.
TIFFOpenOptions * TIFFOpenOptionsAlloc(void)
Allocate default options for opening a TIFF handle.
void TIFFOpenOptionsSetMaxSingleMemAlloc(TIFFOpenOptions *opts, tmsize_t max_single_mem_alloc)
Set the single checked allocation limit for subsequent opens.
void TIFFOpenOptionsFree(TIFFOpenOptions *opts)
Release an open-options object.
void(* tileSeparateRoutine)(TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)
Convert a decoded separate-plane region through a caller-selectable packer.
void(* tileContigRoutine)(TIFFRGBAImage *img, uint32_t *cp, uint32_t x, uint32_t y, uint32_t w, uint32_t h, int32_t fromskew, int32_t toskew, unsigned char *pp)
Convert a decoded contiguous region through a caller-selectable packer.
int TIFFReadRGBAImage(TIFF *tif, uint32_t rwidth, uint32_t rheight, uint32_t *raster, int stop)
Read the current image into a packed RGBA raster.
int TIFFReadRGBAStrip(TIFF *tif, uint32_t row, uint32_t *raster)
Read and convert one whole strip to packed RGBA.
int TIFFReadRGBATile(TIFF *tif, uint32_t col, uint32_t row, uint32_t *raster)
Read and convert one whole tile to packed RGBA.
int TIFFRGBAImageBegin(TIFFRGBAImage *img, TIFF *tif, int stop, char emsg[1024])
Initialise an RGBA reader and select conversion methods.
void TIFFRGBAImageEnd(TIFFRGBAImage *img)
Release RGBA conversion tables and copied colormaps.
int TIFFReadRGBAStripExt(TIFF *tif, uint32_t row, uint32_t *raster, int stop_on_error)
Read and convert one whole strip to packed RGBA.
int TIFFReadRGBATileExt(TIFF *tif, uint32_t col, uint32_t row, uint32_t *raster, int stop_on_error)
Read and convert one whole tile to packed RGBA.
int TIFFRGBAImageOK(TIFF *tif, char emsg[1024])
Check preliminary RGBA compatibility of the current directory.
int TIFFReadRGBAImageOriented(TIFF *tif, uint32_t rwidth, uint32_t rheight, uint32_t *raster, int orientation, int stop)
Read the current image into a packed RGBA raster.
int TIFFRGBAImageGet(TIFFRGBAImage *img, uint32_t *raster, uint32_t rwidth, uint32_t rheight)
Read and convert a selected image area through installed callbacks.
int TIFFVGetFieldDefaulted(TIFF *tif, uint32_t tag, va_list ap)
Query a present tag or a supported default.
int(* TIFFVGetMethod)(TIFF *tif, uint32_t tag, va_list ap)
Implement a handle's variadic tag getter.
int TIFFUnsetField(TIFF *tif, uint32_t tag)
Clear tag presence or remove a stored custom value.
int TIFFVGetField(TIFF *tif, uint32_t tag, va_list ap)
Query a present tag in the current directory.
int TIFFSetField(TIFF *tif, uint32_t tag,...)
Set a tag value in the current in-memory directory.
void(* TIFFPrintMethod)(TIFF *tif, FILE *fd, long flags)
Append extension-specific directory information to a stream.
int TIFFGetFieldDefaulted(TIFF *tif, uint32_t tag,...)
Query a present tag or a supported default.
int(* TIFFVSetMethod)(TIFF *tif, uint32_t tag, va_list ap)
Implement a handle's variadic tag setter.
int TIFFGetField(TIFF *tif, uint32_t tag,...)
Query a present tag in the current directory.
int TIFFVSetField(TIFF *tif, uint32_t tag, va_list ap)
Set a tag value in the current in-memory directory.
tstrile_t tstrip_t
Represent a legacy strip index.
TIFF_SSIZE_T tmsize_t
Represent a signed memory or I/O size in bytes.
tstrile_t ttile_t
Represent a legacy tile index.
uint32_t tstrile_t
Represent a legacy strip or tile index.
TIFFDataType
Identify the on-disk representation of a TIFF directory field.
void * tdata_t
Represent a legacy untyped image-data pointer.
uint16_t tsample_t
Represent a legacy sample index.
uint64_t toff_t
Represent an unsigned file byte offset independently of off_t.
uint32_t tdir_t
Represent a zero-based directory index, rather than a file offset.
uint32_t ttag_t
Represent a legacy directory tag identifier.
tmsize_t tsize_t
Represent a legacy signed I/O byte count.
void * thandle_t
Carry an opaque client I/O context through library callbacks.
const char * TIFFGetVersion(void)
Return the version and copyright banner of the loaded library.
Hold CIE L*a*b*-to-RGB conversion parameters and tables.
int range
Largest table index; initialised to CIELABTORGB_TABLE_RANGE.
float bstep
Blue luminance increment per lookup-table interval. Currently initialised from the red-channel d_YCR/...
float X0
Reference-white X coordinate.
float Z0
Reference-white Z coordinate.
TIFFDisplay display
Inline copy of the display description.
float rstep
Red luminance increment per lookup-table interval.
float gstep
Green luminance increment per lookup-table interval. Currently initialised from the red-channel d_YCR...
float Y0
Reference-white Y coordinate.
Describe a named compression scheme and its initialiser.
const char * name
Codec name; storage lifetime follows the API supplying this descriptor.
TIFFInitMethod init
Callback that installs the codec on a TIFF handle.
uint16_t scheme
Compression identifier, such as COMPRESSION_LZW.
Describe the matrix, luminance, and gamma of an RGB display.
float d_gammaG
Green-channel gamma.
float d_YCB
Blue-channel reference-white luminance.
uint32_t d_Vrwr
Red-channel code value at reference white.
float d_Y0R
Red-channel residual luminance at black.
float d_gammaR
Red-channel gamma.
float d_YCG
Green-channel reference-white luminance.
float d_YCR
Red-channel reference-white luminance.
float d_Y0G
Green-channel residual luminance at black.
float d_Y0B
Blue-channel residual luminance at black.
uint32_t d_Vrwg
Green-channel code value at reference white.
float d_gammaB
Blue-channel gamma.
uint32_t d_Vrwb
Blue-channel code value at reference white.
Describe a tag using the legacy field-registration interface.
uint32_t field_tag
Numeric tag identifier.
const char * field_name
Borrowed null-terminated tag name; keep valid while registered.
unsigned char field_passcount
Nonzero if a count argument accompanies the value in field access calls.
short field_readcount
Expected read count, or a TIFF_VARIABLE, TIFF_VARIABLE2, or TIFF_SPP marker.
unsigned char field_oktochange
Nonzero if the field may change after writing has begun.
TIFFDataType field_type
On-disk TIFFDataType.
unsigned short field_bit
Field-presence bit; use FIELD_CUSTOM for custom fields.
short field_writecount
Expected write count, or a variable/per-sample count marker.
Hold allocation limits and diagnostics used when opening a TIFF handle.
Represent an unsigned TIFF rational as numerator and denominator.
uint32_t uDenom
Unsigned 32-bit denominator; the representation itself performs no validation.
uint32_t uNum
Unsigned 32-bit numerator.
Collect a handle's tag-access and directory-print callbacks.
TIFFVGetMethod vgetfield
Variadic tag-query implementation for the handle.
TIFFVSetMethod vsetfield
Variadic tag-setting implementation for the handle.
TIFFPrintMethod printdir
Optional codec/extension directory-print callback.
Hold lookup-table pointers for 8-bit YCbCr-to-RGB conversion.
int * Cr_r_tab
256-entry table of Cr contributions to red.
int32_t * Cb_g_tab
256-entry fixed-point table of Cb contributions to green.
int32_t * Y_tab
256-entry table of scaled luminance contributions.
TIFFRGBValue * clamptab
Biased table pointer for clamping channel results to 0 through 255.
int * Cb_b_tab
256-entry table of Cb contributions to blue.
int32_t * Cr_g_tab
256-entry fixed-point table of Cr contributions to green.
Describe a borrowed schema or owned compatibility batch.
TIFFFieldArrayType type
Namespace/category of the schema.
Describe a field's file type and internal argument contract.
Hold the state and selected callbacks for an RGBA image reader.
uint32_t ** PALmap
Reader-owned palette expansion tables, or NULL.
int col_offset
Nonnegative starting source column, measured in pixels.
uint16_t req_orientation
Requested output raster orientation.
uint16_t * bluecmap
Reader-owned blue palette copy, or NULL.
uint16_t photometric
Source PhotometricInterpretation tag value.
TIFF * tif
Borrowed TIFF handle; must outlive this reader state.
tileContigRoutine contig
Put callback for contiguous source samples.
uint16_t * greencmap
Reader-owned green palette copy, or NULL.
uint16_t samplesperpixel
Source samples per pixel.
uint8_t * UaToAa
Reader-owned unassociated-to-associated alpha lookup table, or NULL.
union _TIFFRGBAImage::@3 put
Select the RGBA packer signature matching the image organisation.
TIFFCIELabToRGB * cielab
Reader-owned CIE L*a*b* conversion state, or NULL.
uint16_t bitspersample
Source bits per sample.
int alpha
ExtraSamples alpha interpretation, or zero when none is selected.
uint32_t height
Source image height in pixels.
uint16_t orientation
Source Orientation tag value.
uint16_t * redcmap
Reader-owned red palette copy, or NULL.
uint32_t width
Source image width in pixels.
void(* any)(TIFFRGBAImage *img)
Reserve a generic storage view of the selected packer.
uint8_t * Bitdepth16To8
Reader-owned 16-bit-to-8-bit sample lookup table, or NULL.
uint32_t ** BWmap
Reader-owned black/white expansion tables, or NULL.
TIFFRGBValue * Map
Reader-owned sample mapping table, or NULL.
int isContig
Nonzero for contiguous samples; zero for separate sample planes.
int row_offset
Nonnegative starting source row, measured in pixels.
TIFFYCbCrToRGB * ycbcr
Reader-owned YCbCr conversion block, or NULL.
int stoponerr
Nonzero to stop reading when an error is encountered.
int(* get)(TIFFRGBAImage *img, uint32_t *raster, uint32_t rwidth, uint32_t rheight)
Read and pack a raster through the selected RGBA state.
tileSeparateRoutine separate
Put callback for separate source planes.
Hold private state for one open TIFF library instance.
Define TIFF file-format types, tag identifiers, and constant values.
Identify the LibTIFF headers used when compiling an application.