TinyTIFF
a lightweight C/C++ library for reading and writing TIFF files
|
Typedefs | |
typedef struct TinyTIFFWriterFile | TinyTIFFWriterFile |
struct used to describe a TIFF file | |
Enumerations | |
enum | TinyTIFFWriterSampleFormat { TinyTIFFWriter_UInt , TinyTIFFWriter_Int , TinyTIFFWriter_Float } |
allows to specify in TinyTIFFWriter_open() the type of the data More... | |
enum | TinyTIFFWriterSampleInterpretation { TinyTIFFWriter_AutodetectSampleInterpetation , TinyTIFFWriter_Greyscale , TinyTIFFWriter_GreyscaleAndAlpha , TinyTIFFWriter_RGB , TinyTIFFWriter_RGBA } |
allows to specify in TinyTIFFWriter_open() how to interpret the image channels More... | |
Functions | |
TINYTIFF_EXPORT void | TinyTIFFWriter_close (TinyTIFFWriterFile *tiff) |
close a given TIFF file | |
TINYTIFF_EXPORT void | TinyTIFFWriter_close_withdescription (TinyTIFFWriterFile *tiff, const char *imageDescription) |
close a given TIFF file and write the given string into the IMageDescription tag of the first frame in the file. | |
TINYTIFF_EXPORT void | TinyTIFFWriter_close_withmetadatadescription (TinyTIFFWriterFile *tiff, double pixel_width, double pixel_height, double frametime, double deltaz) |
close a given TIFF file | |
TINYTIFF_EXPORT const char * | TinyTIFFWriter_getLastError (TinyTIFFWriterFile *tiff) |
returns a pointer to the last error message | |
TINYTIFF_EXPORT int | TinyTIFFWriter_getMaxDescriptionTextSize () |
maximum size of the imageDescription field in the first frame (including trailing 0 , which has to be present!) | |
TINYTIFF_EXPORT TinyTIFFWriterFile * | TinyTIFFWriter_open (const char *filename, uint16_t bitsPerSample, enum TinyTIFFWriterSampleFormat sampleFormat, uint16_t samples, uint32_t width, uint32_t height, enum TinyTIFFWriterSampleInterpretation sampleInterpretation) |
create a new TIFF file | |
TINYTIFF_EXPORT int | TinyTIFFWriter_success (TinyTIFFWriterFile *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 | TinyTIFFWriter_wasError (TinyTIFFWriterFile *tiff) |
returns TRUE (non-zero) when there was an error in the last function call, or FALSE (zero) if there was no error | |
TINYTIFF_EXPORT int | TinyTIFFWriter_writeImage (TinyTIFFWriterFile *tiff, const void *data) |
Write a new image to the give TIFF file, in chunky configuration, expects the data to be chunky too. This method is here for compatibility with older version on TinyTIFFWriter an for simple semantics for 1-sample data, where the organization does not play any role! | |
TINYTIFF_EXPORT int | TinyTIFFWriter_writeImageChunkyReorder (TinyTIFFWriterFile *tiff, const void *data) |
write a new image to the give TIFF file, in planar configuration, i.e. the image data is reorganized from RGBRGBRGB to RRR...GGG...BBB... before writing. This operation requires additional memory and time! Use TinyTIFFWriter_writeImage() for speed | |
TINYTIFF_EXPORT int | TinyTIFFWriter_writeImageMultiSample (TinyTIFFWriterFile *tiff, const void *data, enum TinyTIFFSampleLayout inputOrganisation, enum TinyTIFFSampleLayout outputOrganization) |
write a new image to the give TIFF file. the image ist stored in separate planes or planar configuration, dependeing on outputOrganization and the data is possibly reorganized | |
TINYTIFF_EXPORT int | TinyTIFFWriter_writeImagePlanarReorder (TinyTIFFWriterFile *tiff, const void *data) |
write a new image to the give TIFF file, in planar configuration, i.e. the image data is reorganized from RGBRGBRGB to RRR...GGG...BBB... before writing. This operation requires additional memory and time! Use TinyTIFFWriter_writeImage() for speed | |
allows to specify in TinyTIFFWriter_open() the type of the data
Enumerator | |
---|---|
TinyTIFFWriter_UInt | unsigned integer images (the default) |
TinyTIFFWriter_Int | signed integer images |
TinyTIFFWriter_Float | floating point images |
allows to specify in TinyTIFFWriter_open() how to interpret the image channels
Enumerator | |
---|---|
TinyTIFFWriter_AutodetectSampleInterpetation | tells TinyTIFFWriter_open() to try and determine the sample interpretation automatically from the sumber of samples! |
TinyTIFFWriter_Greyscale | Greyscale image with one channel (samples need to be at least 1) |
TinyTIFFWriter_GreyscaleAndAlpha | Greyscale image with one channel and one additional ALPHA channel (samples need to be at least 2) |
TinyTIFFWriter_RGB | RGB image with three channel (samples need to be at least 3) |
TinyTIFFWriter_RGBA | RGBA image with four channel (samples need to be at least 4) |
TINYTIFF_EXPORT void TinyTIFFWriter_close | ( | TinyTIFFWriterFile * | tiff | ) |
close a given TIFF file
tiff | TIFF file to close |
This function also releases memory allocated in TinyTIFFWriter_open() in tiff.
TINYTIFF_EXPORT void TinyTIFFWriter_close_withdescription | ( | TinyTIFFWriterFile * | tiff, |
const char * | imageDescription | ||
) |
close a given TIFF file and write the given string into the IMageDescription tag of the first frame in the file.
tiff | TIFF file to close |
imageDescription | ImageDescription tag contents (max. size: TINYTIFFWRITER_DESCRIPTION_SIZE, including trailing 0!!!) |
This function also releases memory allocated in TinyTIFFWriter_open() in tiff.
TINYTIFF_EXPORT void TinyTIFFWriter_close_withmetadatadescription | ( | TinyTIFFWriterFile * | tiff, |
double | pixel_width, | ||
double | pixel_height, | ||
double | frametime, | ||
double | deltaz | ||
) |
close a given TIFF file
tiff | TIFF file to close |
pixel_width | pixel width in nanometers |
pixel_height | pixel width in nanometers |
deltaz | in a multi-frame-TIFF distance between image planes in nanometers |
frametime | in a multi-frame-TIFF frametime in seconds |
This functions writes some additional data into the ImageDescription field of the first frame, if it is proved (!=0!!!). It also writes the image count there. The ImageDescription finally has the form:
TinyTIFFWriter_version=1.1 images=1000 pixel_width=100 pixel_height=100 deltaz=100 frametime=1e-4
This function also releases memory allocated in TinyTIFFWriter_open() in tiff.
TINYTIFF_EXPORT const char * TinyTIFFWriter_getLastError | ( | TinyTIFFWriterFile * | tiff | ) |
returns a pointer to the last error message
tiff | TIFF file |
TINYTIFF_EXPORT TinyTIFFWriterFile * TinyTIFFWriter_open | ( | const char * | filename, |
uint16_t | bitsPerSample, | ||
enum TinyTIFFWriterSampleFormat | sampleFormat, | ||
uint16_t | samples, | ||
uint32_t | width, | ||
uint32_t | height, | ||
enum TinyTIFFWriterSampleInterpretation | sampleInterpretation | ||
) |
create a new TIFF file
filename | name of the new TIFF file |
number | of samples per pixel (e.g. 3 for RGB images) |
bitsPerSample | bits used to save each sample of the images |
samples | number of samples in each frame, See documentation of TinyTIFFWriterSampleInterpretation for limitations that apply, if set to 0, the number of samples is automatically determined from the value of sampleInterpretation |
width | width of the images in pixels |
height | height of the images in pixels |
sampleFormat | data type of data in image pixels |
sampleInterpretation | how to interpret the samples in each frame. Note that you may specify more samples than required by the value from TinyTIFFWriterSampleInterpretation these are then marked as unspecified samples. If you want to store alpha information or else, choose the correct value from TinyTIFFWriterSampleInterpretation! if TinyTIFFWriter_AutodetectSampleInterpetation is specified, the sample interpretation is choosen from the number of channels (as specified in TinyTIFFWriterSampleInterpretation, i.e. 1 channel=greyscale, 2 channels=greyscale+alpha, 3 channels=RGB, 4 channels= RGBA) |
TINYTIFF_EXPORT int TinyTIFFWriter_success | ( | TinyTIFFWriterFile * | tiff | ) |
returns TINYTIFF_TRUE (non-zero) when there was no error in the last function call, or TINYTIFF_FALSE if there was an error
tiff | TIFF file |
TINYTIFF_EXPORT int TinyTIFFWriter_wasError | ( | TinyTIFFWriterFile * | tiff | ) |
returns TRUE (non-zero) when there was an error in the last function call, or FALSE (zero) if there was no error
tiff | TIFF file |
TINYTIFF_EXPORT int TinyTIFFWriter_writeImage | ( | TinyTIFFWriterFile * | tiff, |
const void * | data | ||
) |
Write a new image to the give TIFF file, in chunky configuration, expects the data to be chunky too. This method is here for compatibility with older version on TinyTIFFWriter an for simple semantics for 1-sample data, where the organization does not play any role!
This is equivalent to calling
tiff | TIFF file to write to |
data | points to the image in row-major ordering with the right bit-depth, multi-sample data has to be provided in the "chunky" format, e.g. if you have 3 samples ("R", "G" and "B"), the the data in this field has to be R1G1B1|R2G2B2|R3G3B3|R4G4B4| ... |
TINYTIFF_EXPORT int TinyTIFFWriter_writeImageChunkyReorder | ( | TinyTIFFWriterFile * | tiff, |
const void * | data | ||
) |
write a new image to the give TIFF file, in planar configuration, i.e. the image data is reorganized from RGBRGBRGB to RRR...GGG...BBB... before writing. This operation requires additional memory and time! Use TinyTIFFWriter_writeImage() for speed
This is equivalent to calling
tiff | TIFF file to write to |
data | points to the image in row-major ordering with the right bit-depth, multi-sample data has to be provided in the "planat" format, e.g. if you have 3 samples ("R", "G" and "B"), the the data in this field has to be R1R2R3R4 ...G1G2G3G4...B1B2B3B4... |
TINYTIFF_EXPORT int TinyTIFFWriter_writeImageMultiSample | ( | TinyTIFFWriterFile * | tiff, |
const void * | data, | ||
enum TinyTIFFSampleLayout | inputOrganisation, | ||
enum TinyTIFFSampleLayout | outputOrganization | ||
) |
write a new image to the give TIFF file. the image ist stored in separate planes or planar configuration, dependeing on outputOrganization and the data is possibly reorganized
tiff | TIFF file to write to |
data | points to the image in row-major ordering with the right bit-depth, multi-sample data has to be provided in the format defined by inputOrganisation |
inputOrganisation | data format of the multi-channel data in data |
outputOrganization | data format of the image data in the generated TIFF file |
TINYTIFF_EXPORT int TinyTIFFWriter_writeImagePlanarReorder | ( | TinyTIFFWriterFile * | tiff, |
const void * | data | ||
) |
write a new image to the give TIFF file, in planar configuration, i.e. the image data is reorganized from RGBRGBRGB to RRR...GGG...BBB... before writing. This operation requires additional memory and time! Use TinyTIFFWriter_writeImage() for speed
This is equivalent to calling
tiff | TIFF file to write to |
data | points to the image in row-major ordering with the right bit-depth, multi-sample data has to be provided in the "chunky" format, e.g. if you have 3 samples ("R", "G" and "B"), the the data in this field has to be R1G1B1|R2G2B2|R3G3B3|R4G4B4| ... |