JWS C Library
C language utility library
image_io.h File Reference

Declarations for functions to read and write images. More...

#include <jwsc/config.h>
#include <stdlib.h>
#include "jwsc/base/error.h"
#include "jwsc/image/image.h"
Include dependency graph for image_io.h:

Go to the source code of this file.

Functions

read_image

Reads an image from a file.

Errorread_image_f (Image_f **img_out, const char *fname)
 Reads a single precision floating point image from a file.
write_image

Reads a single precision floating point image from a file using ImageMagick.

Writes an image to a file.

Errorwrite_image_f (const Image_f *img, const char *fname)
 Write a single precision floating point image to a file.

Detailed Description

Declarations for functions to read and write images.

Author:
Joseph Schlecht
License:
Creative Commons BY-NC-SA 3.0

Definition in file image_io.h.


Function Documentation

Error* read_image_f ( Image_f **  img_out,
const char *  fname 
)

Reads a single precision floating point image from a file.

The type of image to read is based on the file name suffix.

Parameters:
img_outResult parameter. If *img_out is NULL, an image is allocated; otherwise its space is re-used.
fnameName of the image file to read.
Note:
File names are assumed to be of length <= 256 characters.
Returns:
On success, NULL is returned. On error, an Error is returned and *img_out is freed and set to NULL.
  • ERROR_IO Could not read an image from fname.

Definition at line 88 of file image_io.c.

Error* write_image_f ( const Image_f img,
const char *  fname 
)

Write a single precision floating point image to a file.

Parameters:
imgImage to write.
fnameName of the file to write the image to.
Returns:
On success, NULL is returned. On error, an Error is returned.
  • ERROR_IO Could not write an image to fname.

Definition at line 191 of file image_io.c.