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

JWS image file format. More...

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

Go to the source code of this file.

Data Structures

struct  JIFF_attributes
 Attributes for a JIFF image. More...

Enumerations

enum  JIFF_colorspace { JIFF_GRAY, JIFF_RGB }
 Colorspace for a JIFF image. More...
enum  JIFF_depth { JIFF_8_BIT, JIFF_16_BIT, JIFF_32_BIT }
 Depth for colorspace channels. More...
enum  JIFF_type { JIFF_INTEGER, JIFF_FLOAT }
 Channel type. More...

Functions

void init_jiff_attributes (JIFF_attributes *attrs)
 Initializes a JIFF_attributes with defaults values.
Errorread_image_as_jiff_f (Image_f **img_out, const char *fname)
 Reads an Image_f from a JIFF image file.
Errorwrite_image_as_jiff_f (const Image_f *img, const char *fname, const JIFF_attributes *attrs)
 Writes an Image_f to a JIFF image file.

Detailed Description

JWS image file format.

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

Specifies an integer or floating point image with grayscale or RGB channels.

Definition in file jiff.h.


Enumeration Type Documentation

Colorspace for a JIFF image.

Enumerator:
JIFF_GRAY 

Single-channel, grayscaled image.

JIFF_RGB 

Three-channel, RGB image.

Definition at line 68 of file jiff.h.

enum JIFF_depth

Depth for colorspace channels.

Enumerator:
JIFF_8_BIT 

8-bit channels.

JIFF_16_BIT 

16-bit channels.

JIFF_32_BIT 

32-bit channels.

Definition at line 77 of file jiff.h.

enum JIFF_type

Channel type.

Enumerator:
JIFF_INTEGER 

Integer channels.

JIFF_FLOAT 

Floating point channels.

Definition at line 87 of file jiff.h.


Function Documentation

void init_jiff_attributes ( JIFF_attributes attrs)

Initializes a JIFF_attributes with defaults values.

Parameters:
attrsAttributes to initialize.

Definition at line 87 of file jiff.c.

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

Reads an Image_f from a JIFF image file.

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.
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 jiff image from fname.

Definition at line 117 of file jiff.c.

Error* write_image_as_jiff_f ( const Image_f img,
const char *  fname,
const JIFF_attributes attrs 
)

Writes an Image_f to a JIFF image file.

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

Definition at line 359 of file jiff.c.