Defines | Functions

io_png.h File Reference

#include <stddef.h>
Include dependency graph for io_png.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define IO_PNG_VERSION   "0.20110608"

Functions

unsigned char * io_png_read_u8 (const char *fname, size_t *nxp, size_t *nyp, size_t *ncp)
 read a PNG file into a 8bit integer array
unsigned char * io_png_read_u8_rgb (const char *fname, size_t *nxp, size_t *nyp)
 read a PNG file into a 8bit integer array, converted to RGB
unsigned char * io_png_read_u8_gray (const char *fname, size_t *nxp, size_t *nyp)
 read a PNG file into a 8bit integer array, converted to gray
float * io_png_read_f32 (const char *fname, size_t *nxp, size_t *nyp, size_t *ncp)
 read a PNG file into a 32bit float array
float * io_png_read_f32_rgb (const char *fname, size_t *nxp, size_t *nyp)
 read a PNG file into a 32bit float array, converted to RGB
float * io_png_read_f32_gray (const char *fname, size_t *nxp, size_t *nyp)
 read a PNG file into a 32bit float array, converted to gray
int io_png_write_u8 (const char *fname, const unsigned char *data, size_t nx, size_t ny, size_t nc)
 write a 8bit unsigned integer array into a PNG file
int io_png_write_f32 (const char *fname, const float *data, size_t nx, size_t ny, size_t nc)
 write a float array into a PNG file

Define Documentation

#define IO_PNG_VERSION   "0.20110608"

Definition at line 8 of file io_png.h.


Function Documentation

float* io_png_read_f32 ( const char *  fname,
size_t *  nxp,
size_t *  nyp,
size_t *  ncp 
)

read a PNG file into a 32bit float array

The array contains the deinterlaced channels. 1, 2, 4 and 8bit images are converted to float values between 0. and 1., 3., 15. or 255. 16bit images are also downscaled to 8bit before conversion.

Parameters:
fname PNG file name
nxp,nyp,ncp pointers to variables to be filled with the number of columns, lines and channels of the image
Returns:
pointer to an allocated unsigned char array of pixels, or NULL if an error happens

Definition at line 369 of file io_png.c.

Here is the call graph for this function:

float* io_png_read_f32_gray ( const char *  fname,
size_t *  nxp,
size_t *  nyp 
)

read a PNG file into a 32bit float array, converted to gray

See io_png_read_f32() for details.

Definition at line 422 of file io_png.c.

Here is the call graph for this function:

float* io_png_read_f32_rgb ( const char *  fname,
size_t *  nxp,
size_t *  nyp 
)

read a PNG file into a 32bit float array, converted to RGB

See io_png_read_f32() for details.

Definition at line 382 of file io_png.c.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned char* io_png_read_u8 ( const char *  fname,
size_t *  nxp,
size_t *  nyp,
size_t *  ncp 
)

read a PNG file into a 8bit integer array

The array contains the deinterlaced channels. 1, 2 and 4bit images are converted to 8bit. 16bit images are previously downscaled to 8bit.

Todo:
don't downscale 16bit images.
Parameters:
fname PNG file name
nxp,nyp,ncp pointers to variables to be filled with the number of columns, lines and channels of the image
Returns:
pointer to an allocated unsigned char array of pixels, or NULL if an error happens

Definition at line 257 of file io_png.c.

Here is the call graph for this function:

unsigned char* io_png_read_u8_gray ( const char *  fname,
size_t *  nxp,
size_t *  nyp 
)

read a PNG file into a 8bit integer array, converted to gray

See io_png_read_u8() for details.

Definition at line 314 of file io_png.c.

Here is the call graph for this function:

unsigned char* io_png_read_u8_rgb ( const char *  fname,
size_t *  nxp,
size_t *  nyp 
)

read a PNG file into a 8bit integer array, converted to RGB

See io_png_read_u8() for details.

Definition at line 271 of file io_png.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int io_png_write_f32 ( const char *  fname,
const float *  data,
size_t  nx,
size_t  ny,
size_t  nc 
)

write a float array into a PNG file

The float values are rounded to 8bit integers, and bounded to [0, 255].

Todo:
handle 16bit images and flexible min/max
Parameters:
fname PNG file name
data array to write
nx,ny,nc number of columns, lines and channels of the image
Returns:
0 if everything OK, -1 if an error occured

Definition at line 680 of file io_png.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int io_png_write_u8 ( const char *  fname,
const unsigned char *  data,
size_t  nx,
size_t  ny,
size_t  nc 
)

write a 8bit unsigned integer array into a PNG file

Parameters:
fname PNG file name
data array to write
nx,ny,nc number of columns, lines and channels of the image
Returns:
0 if everything OK, -1 if an error occured

Definition at line 660 of file io_png.c.

Here is the call graph for this function:

Here is the caller graph for this function:

 All Files Functions Variables Defines