TinyTIFF
a lightweight C/C++ library for reading and writing TIFF files
Loading...
Searching...
No Matches

Functions

TINYTIFF_EXPORT void TinyTIFFReader_close (TinyTIFFReaderFile *tiff)
 close a given TIFF file
 
TINYTIFF_EXPORT uint32_t TinyTIFFReader_countFrames (TinyTIFFReaderFile *tiff)
 return the width of the current frame
 
TINYTIFF_EXPORT uint16_t TinyTIFFReader_getBitsPerSample (TinyTIFFReaderFile *tiff, int sample)
 return the bits per sample of the current frame
 
TINYTIFF_EXPORT uint32_t TinyTIFFReader_getHeight (TinyTIFFReaderFile *tiff)
 return the height of the current frame
 
TINYTIFF_EXPORT const char * TinyTIFFReader_getImageDescription (TinyTIFFReaderFile *tiff)
 return the image description of the current frame
 
TINYTIFF_EXPORT const char * TinyTIFFReader_getLastError (TinyTIFFReaderFile *tiff)
 returns a pointer to the last error message
 
TINYTIFF_EXPORT uint16_t TinyTIFFReader_getResolutionUnit (TinyTIFFReaderFile *tiff)
 return the base unit for resolution
 
TINYTIFF_EXPORT int TinyTIFFReader_getSampleData (TinyTIFFReaderFile *tiff, void *buffer, uint16_t sample)
 read the given sample from the current frame into the given buffer, the byteorder is transformed to the byteorder of the system!
 
TINYTIFF_EXPORT int TinyTIFFReader_getSampleData_s (TinyTIFFReaderFile *tiff, void *buffer, unsigned long buffer_size, uint16_t sample)
 read the given sample from the current frame into the given buffer, the byteorder is transformed to the byteorder of the system! This is a secure version of TinyTIFFReader_getSampleData() that also accepts the size of the output buffer for additional security checks!
 
TINYTIFF_EXPORT uint16_t TinyTIFFReader_getSampleFormat (TinyTIFFReaderFile *tiff)
 return the sample format of the current frame
 
TINYTIFF_EXPORT uint16_t TinyTIFFReader_getSamplesPerPixel (TinyTIFFReaderFile *tiff)
 return the samples per pixel of the current frame
 
TINYTIFF_EXPORT const char * TinyTIFFReader_getVersion ()
 returns the version number of TinyTIFFReader
 
TINYTIFF_EXPORT uint32_t TinyTIFFReader_getWidth (TinyTIFFReaderFile *tiff)
 return the width of the current frame
 
TINYTIFF_EXPORT float TinyTIFFReader_getXResolution (TinyTIFFReaderFile *tiff)
 return the pixels per basic resolution unit in image width direction
 
TINYTIFF_EXPORT float TinyTIFFReader_getYResolution (TinyTIFFReaderFile *tiff)
 return the pixels per basic resolution unit in image height direction
 
TINYTIFF_EXPORT int TinyTIFFReader_hasNext (TinyTIFFReaderFile *tiff)
 returns TINYTIFF_TRUE (non-zero) if another frame exists in the TIFF file
 
TINYTIFF_EXPORT TinyTIFFReaderFileTinyTIFFReader_open (const char *filename)
 open TIFF file for reading
 
TINYTIFF_EXPORT int TinyTIFFReader_readNext (TinyTIFFReaderFile *tiff)
 reads the next frame from a multi-frame TIFF
 
TINYTIFF_EXPORT int TinyTIFFReader_success (TinyTIFFReaderFile *tiff)
 returns TINYTIFF_TRUE (non-zero) when there was no error in the last function call, or TINYTIFF_FALSE if there was an error
 
TINYTIFF_EXPORT int TinyTIFFReader_wasError (TinyTIFFReaderFile *tiff)
 returns TINYTIFF_TRUE (non-zero) when there was an error in the last function call, or TINYTIFF_FALSE if there was no error
 
TINYTIFF_EXPORT const char * TinyTIFFWriter_getVersion ()
 returns the version number of TinyTIFFReader
 

Detailed Description

Function Documentation

◆ TinyTIFFReader_close()

TINYTIFF_EXPORT void TinyTIFFReader_close ( TinyTIFFReaderFile tiff)

close a given TIFF file

Parameters
tiffTIFF file to close

This function also releases memory allocated in TinyTIFFReader_open() in tiff.

◆ TinyTIFFReader_countFrames()

TINYTIFF_EXPORT uint32_t TinyTIFFReader_countFrames ( TinyTIFFReaderFile tiff)

return the width of the current frame

Parameters
tiffTIFF file

◆ TinyTIFFReader_getBitsPerSample()

TINYTIFF_EXPORT uint16_t TinyTIFFReader_getBitsPerSample ( TinyTIFFReaderFile tiff,
int  sample 
)

return the bits per sample of the current frame

Parameters
tiffTIFF file
samplereturn bits for the given sample number [default: 0]

◆ TinyTIFFReader_getHeight()

TINYTIFF_EXPORT uint32_t TinyTIFFReader_getHeight ( TinyTIFFReaderFile tiff)

return the height of the current frame

Parameters
tiffTIFF file

◆ TinyTIFFReader_getImageDescription()

TINYTIFF_EXPORT const char * TinyTIFFReader_getImageDescription ( TinyTIFFReaderFile tiff)

return the image description of the current frame

Parameters
tiffTIFF file

◆ TinyTIFFReader_getLastError()

TINYTIFF_EXPORT const char * TinyTIFFReader_getLastError ( TinyTIFFReaderFile tiff)

returns a pointer to the last error message

Parameters
tiffTIFF file
Note
the pointer is accessible as long as the TIFF file has not been closed using TinyTIFFReader_close()

◆ TinyTIFFReader_getResolutionUnit()

TINYTIFF_EXPORT uint16_t TinyTIFFReader_getResolutionUnit ( TinyTIFFReaderFile tiff)

return the base unit for resolution

Parameters
tiffTIFF file
Returns
TIFF_RESOLUTION_UNIT_NONE, TIFF_RESOLUTION_UNIT_INCH or TIFF_RESOLUTION_UNIT_CENTIMETER

◆ TinyTIFFReader_getSampleData()

TINYTIFF_EXPORT int TinyTIFFReader_getSampleData ( TinyTIFFReaderFile tiff,
void *  buffer,
uint16_t  sample 
)

read the given sample from the current frame into the given buffer, the byteorder is transformed to the byteorder of the system!

Parameters
tiffTIFF file
bufferthe buffer this function writes into, the size has to be at least TinyTIFFReader_getWidth() * TinyTIFFReader_getHeight() * TinyTIFFReader_getBitsPerSample() / 8
samplethe sample to read [default: 0]
Returns
TINYTIFF_TRUE (non-zero) on success, if an error occured TINYTIFF_FALSE is returned and the error message can be retrieved with TinyTIFFReader_getLastError()
Warning
The user is responsible for providing the correct buffer size (taking width, height and bitsPerSample into account). BUT: There is a security-hardened version TinyTIFFReader_getSampleData_s() of this function!

◆ TinyTIFFReader_getSampleData_s()

TINYTIFF_EXPORT int TinyTIFFReader_getSampleData_s ( TinyTIFFReaderFile tiff,
void *  buffer,
unsigned long  buffer_size,
uint16_t  sample 
)

read the given sample from the current frame into the given buffer, the byteorder is transformed to the byteorder of the system! This is a secure version of TinyTIFFReader_getSampleData() that also accepts the size of the output buffer for additional security checks!

Parameters
tiffTIFF file
bufferthe buffer this function writes into, the size has to be at least TinyTIFFReader_getWidth() * TinyTIFFReader_getHeight() * TinyTIFFReader_getBitsPerSample() / 8
buffer_sizesize of buffer
samplethe sample to read [default: 0]
Returns
TINYTIFF_TRUE (non-zero) on success, if an error occured TINYTIFF_FALSE is returned and the error message can be retrieved with TinyTIFFReader_getLastError()

◆ TinyTIFFReader_getSampleFormat()

TINYTIFF_EXPORT uint16_t TinyTIFFReader_getSampleFormat ( TinyTIFFReaderFile tiff)

return the sample format of the current frame

Parameters
tiffTIFF file

◆ TinyTIFFReader_getSamplesPerPixel()

TINYTIFF_EXPORT uint16_t TinyTIFFReader_getSamplesPerPixel ( TinyTIFFReaderFile tiff)

return the samples per pixel of the current frame

Parameters
tiffTIFF file

◆ TinyTIFFReader_getWidth()

TINYTIFF_EXPORT uint32_t TinyTIFFReader_getWidth ( TinyTIFFReaderFile tiff)

return the width of the current frame

Parameters
tiffTIFF file

◆ TinyTIFFReader_getXResolution()

TINYTIFF_EXPORT float TinyTIFFReader_getXResolution ( TinyTIFFReaderFile tiff)

return the pixels per basic resolution unit in image width direction

Parameters
tiffTIFF file

◆ TinyTIFFReader_getYResolution()

TINYTIFF_EXPORT float TinyTIFFReader_getYResolution ( TinyTIFFReaderFile tiff)

return the pixels per basic resolution unit in image height direction

Parameters
tiffTIFF file

◆ TinyTIFFReader_hasNext()

TINYTIFF_EXPORT int TinyTIFFReader_hasNext ( TinyTIFFReaderFile tiff)

returns TINYTIFF_TRUE (non-zero) if another frame exists in the TIFF file

Parameters
tiffTIFF file

◆ TinyTIFFReader_open()

TINYTIFF_EXPORT TinyTIFFReaderFile * TinyTIFFReader_open ( const char *  filename)

open TIFF file for reading

Parameters
filenamename of the new TIFF file
Returns
a new TinyTIFFReaderFile pointer on success, or NULL on errors, Note that you can not use TinyTIFFReader_getLastError() if NULL is returned! In this case the C method open() retrned an error, so the fiel didn't exist, or you do not have permission to read it. Also if no TIFF file was detected (first twi bytes were neither 'II' nor 'MM') NULL is returned.

◆ TinyTIFFReader_readNext()

TINYTIFF_EXPORT int TinyTIFFReader_readNext ( TinyTIFFReaderFile tiff)

reads the next frame from a multi-frame TIFF

Parameters
tiffTIFF file
Returns
TINYTIFF_TRUE (non-zero) if another frame exists in the TIFF file

◆ TinyTIFFReader_success()

TINYTIFF_EXPORT int TinyTIFFReader_success ( TinyTIFFReaderFile tiff)

returns TINYTIFF_TRUE (non-zero) when there was no error in the last function call, or TINYTIFF_FALSE if there was an error

Parameters
tiffTIFF file

◆ TinyTIFFReader_wasError()

TINYTIFF_EXPORT int TinyTIFFReader_wasError ( TinyTIFFReaderFile tiff)

returns TINYTIFF_TRUE (non-zero) when there was an error in the last function call, or TINYTIFF_FALSE if there was no error

Parameters
tiffTIFF file