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

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 TinyTIFFWriterFileTinyTIFFWriter_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
 

Detailed Description

Enumeration Type Documentation

◆ TinyTIFFWriterSampleFormat

allows to specify in TinyTIFFWriter_open() the type of the data

See also
TinyTIFFWriter_open()
Enumerator
TinyTIFFWriter_UInt 

unsigned integer images (the default)

TinyTIFFWriter_Int 

signed integer images

TinyTIFFWriter_Float 

floating point images

◆ TinyTIFFWriterSampleInterpretation

allows to specify in TinyTIFFWriter_open() how to interpret the image channels

See also
TinyTIFFWriter_open()
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)

Function Documentation

◆ TinyTIFFWriter_close()

TINYTIFF_EXPORT void TinyTIFFWriter_close ( TinyTIFFWriterFile tiff)

close a given TIFF file

Parameters
tiffTIFF file to close

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

◆ TinyTIFFWriter_close_withdescription()

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.

Parameters
tiffTIFF file to close
imageDescriptionImageDescription tag contents (max. size: TINYTIFFWRITER_DESCRIPTION_SIZE, including trailing 0!!!)

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

◆ TinyTIFFWriter_close_withmetadatadescription()

TINYTIFF_EXPORT void TinyTIFFWriter_close_withmetadatadescription ( TinyTIFFWriterFile tiff,
double  pixel_width,
double  pixel_height,
double  frametime,
double  deltaz 
)

close a given TIFF file

Parameters
tiffTIFF file to close
pixel_widthpixel width in nanometers
pixel_heightpixel width in nanometers
deltazin a multi-frame-TIFF distance between image planes in nanometers
frametimein 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.

◆ TinyTIFFWriter_getLastError()

TINYTIFF_EXPORT const char * TinyTIFFWriter_getLastError ( TinyTIFFWriterFile 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 TINYTIFFWRITER_close()

◆ TinyTIFFWriter_open()

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

Parameters
filenamename of the new TIFF file
numberof samples per pixel (e.g. 3 for RGB images)
bitsPerSamplebits used to save each sample of the images
samplesnumber 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
widthwidth of the images in pixels
heightheight of the images in pixels
sampleFormatdata type of data in image pixels
sampleInterpretationhow 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)
Returns
a new TinyTIFFWriterFile pointer on success, or NULL on errors
See also
TinyTIFFWriterSampleInterpretation

◆ TinyTIFFWriter_success()

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

Parameters
tiffTIFF file

◆ TinyTIFFWriter_wasError()

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

Parameters
tiffTIFF file

◆ TinyTIFFWriter_writeImage()

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

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 configurat...
Definition tinytiffwriter.c:957
@ TinyTIFF_Interleaved
Definition tinytiff_defs.h:74
Parameters
tiffTIFF file to write to
datapoints 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|...
Returns
TINYTIFF_TRUE on success and TINYTIFF_FALSE on failure. An error description can be obtained by calling TinyTIFFWriter_getLastError().

◆ TinyTIFFWriter_writeImageChunkyReorder()

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

@ TinyTIFF_Separate
Definition tinytiff_defs.h:76
Parameters
tiffTIFF file to write to
datapoints 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...
Returns
TINYTIFF_TRUE on success and TINYTIFF_FALSE on failure. An error description can be obtained by calling TinyTIFFWriter_getLastError().
Note
Note that the reorganization from planar to chunky requires additional time and memory! This can be seen in the following image comparing the performance of non-reordered writing (left) and writing with reordering

◆ TinyTIFFWriter_writeImageMultiSample()

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

Note
if outputOrganization does not match inputOrganisation. Note that such a reorganization requires additional time and memory! This can be seen in the following image comparing the performance of non-reordered writing (left) and writing with reordering
Parameters
tiffTIFF file to write to
datapoints 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
inputOrganisationdata format of the multi-channel data in data
outputOrganizationdata format of the image data in the generated TIFF file
Returns
TINYTIFF_TRUE on success and TINYTIFF_FALSE on failure. An error description can be obtained by calling TinyTIFFWriter_getLastError().

◆ TinyTIFFWriter_writeImagePlanarReorder()

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

Parameters
tiffTIFF file to write to
datapoints 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|...
Returns
TINYTIFF_TRUE on success and TINYTIFF_FALSE on failure. An error description can be obtained by calling TinyTIFFWriter_getLastError().
Note
Note that the reorganization from chunky to planar requires additional time and memory! This can be seen in the following image comparing the performance of non-reordered writing (left) and writing with reordering