mcm/io_tiff_all.c File Reference

TIFF I/O routines. More...

#include <stdlib.h>
#include <string.h>
#include "tiffio.h"
Include dependency graph for io_tiff_all.c:

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

Detailed Description

TIFF I/O routines.

Author:
Nicolas Limare <nicolas.limare@cmla.ens-cachan.fr>
Todo:

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.


Function Documentation

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.

Parameters:
[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
Returns:
the data array pointer, NULL if an error occured

Definition at line 157 of file io_tiff_all.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
[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
Returns:
the data array pointer, NULL if an error occured

Definition at line 57 of file io_tiff_all.c.

Here is the caller graph for this function:

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.

Parameters:
[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
Returns:
the data array pointer, NULL if an error occured

Definition at line 201 of file io_tiff_all.c.

Here is the call graph for this function:

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

Parameters:
[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
Returns:
$ 0 $ if OK, $\neq 0 $ if an error occured

Definition at line 351 of file io_tiff_all.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
[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
Returns:
$ 0 $ if OK, $\neq 0 $ if an error occured

Definition at line 259 of file io_tiff_all.c.

Here is the caller graph for this function:

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.

Parameters:
[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
Returns:
$ 0 $ if OK, $\neq 0 $ if an error occured

Definition at line 395 of file io_tiff_all.c.

Here is the call graph for this function:

Generated on Thu Sep 1 15:24:08 2011 for fds_mcm by  doxygen 1.6.3