TIFF I/O routines. More...
#include <stdlib.h>
#include <string.h>
#include "tiffio.h"
Go to the source code of this file.
Functions | |
static uint8 * | read_tiff_rgba_raw (const char *fname, size_t *nx, size_t *ny, size_t *nc) |
load the raw data from a TIFF image file as a deinterlaced uint8 array. | |
float * | read_tiff_f32 (const char *fname, size_t *nx, size_t *ny, size_t *nc) |
load the data from a TIFF image file as a float RGB or grayscale array | |
unsigned char * | read_tiff_u8 (const char *fname, size_t *nx, size_t *ny, size_t *nc) |
load the data from a TIFF image file as a 8bit RGB or grayscale array | |
static int | write_tiff_raw (const char *fname, const uint8 *data_raw, size_t nx, size_t ny, size_t nc) |
save an array into a TIFF file | |
int | write_tiff_f32 (const char *fname, const float *data, size_t nx, size_t ny, size_t nc) |
save one or three contiguous float arrays into a TIFF file | |
int | write_tiff_u8 (const char *fname, const unsigned char *data, size_t nx, size_t ny, size_t nc) |
save one or three unsigned char arrays into a TIFF file |
TIFF I/O routines.
stdin/stdout handling
TIFF float version
These routines focus on 8bit TIFF files. These files can be read into or written from unsigned char or float arrays. Only RGB and grayscale images are handled.
These functions could be improved to use less memory, especially for 8bit or grayscale images.
Definition in file io_tiff_all.c.
float* read_tiff_f32 | ( | const char * | fname, | |
size_t * | nx, | |||
size_t * | ny, | |||
size_t * | nc | |||
) |
load the data from a TIFF image file as a float RGB or grayscale array
The array is allocated in this function call. It holds the RGB pixels as 3 contiguous arrays.
[in] | fname | the file name to read |
[in] | nx | memory space for the image width |
[in] | ny | memory space for the image height |
[in] | nc | memory space for number of channels |
Definition at line 157 of file io_tiff_all.c.
static uint8* read_tiff_rgba_raw | ( | const char * | fname, | |
size_t * | nx, | |||
size_t * | ny, | |||
size_t * | nc | |||
) | [static] |
load the raw data from a TIFF image file as a deinterlaced uint8 array.
The array is allocated by this function.
[in] | fname | the file name to read |
[in] | nx | memory space for the image width |
[in] | ny | memory space for the image height |
[in] | nc | memory space for number of channels |
Definition at line 57 of file io_tiff_all.c.
unsigned char* read_tiff_u8 | ( | const char * | fname, | |
size_t * | nx, | |||
size_t * | ny, | |||
size_t * | nc | |||
) |
load the data from a TIFF image file as a 8bit RGB or grayscale array
The array is allocated in this function call. It hold the RGB pixels as 3 contiguous arrays.
[in] | fname | the file name to read |
[in] | nx | memory space for the image width |
[in] | ny | memory space for the image height |
[in] | nc | memory space for number of channels |
Definition at line 201 of file io_tiff_all.c.
int write_tiff_f32 | ( | const char * | fname, | |
const float * | data, | |||
size_t | nx, | |||
size_t | ny, | |||
size_t | nc | |||
) |
save one or three contiguous float arrays into a TIFF file
[in] | fname | TIFF file name |
[in] | data | input array of float values supposed in [0,255] 1 or 3 contiguous color channels arrays |
[in] | nx | memory space for the image width |
[in] | ny | memory space for the image height |
[in] | nc | memory space for number of channels |
Definition at line 351 of file io_tiff_all.c.
static int write_tiff_raw | ( | const char * | fname, | |
const uint8 * | data_raw, | |||
size_t | nx, | |||
size_t | ny, | |||
size_t | nc | |||
) | [static] |
save an array into a TIFF file
The TIFF file is gray or RGB 8bit LZW-compressed. Only 1 channel (grayscale) and 3 channels (rgb) images are handled.
Note: some operations on grayscale images are useless, but kept for code symmetry.
[in] | fname | the file name to write |
[out] | data_raw | image data array, nx x ny x nc uint8 |
[in] | nx | memory space for the image width |
[in] | ny | memory space for the image height |
[in] | nc | memory space for number of channels |
Definition at line 259 of file io_tiff_all.c.
int write_tiff_u8 | ( | const char * | fname, | |
const unsigned char * | data, | |||
size_t | nx, | |||
size_t | ny, | |||
size_t | nc | |||
) |
save one or three unsigned char arrays into a TIFF file
Note: the conversion here is useless, but kept for code symmetry.
[in] | fname | TIFF file name |
[in] | data | input array of unsigned char values, 1 or 3 contiguous color channels arrays |
[in] | nx | memory space for the image width |
[in] | ny | memory space for the image height |
[in] | nc | memory space for number of channels |
Definition at line 395 of file io_tiff_all.c.