Signal/Geometry Processing Library (SPL) 1.1.24 |

Functions
Image Codecs
Audio and Image Codecs

Image file I/O support. More...

## Functions
template<class T >
int | SPL::encodePnm (std::ostream &outStream, const std::vector< Array2< T > > &comps, int maxVal, bool sgnd, bool binaryFormat=true)
| Output the array as an image in the PNM format. More...
template<class T >
int | SPL::encodePbm (std::ostream &outStream, const Array2< T > &bits, bool binaryFormat=true)
| Output the array as an image in the PNM format (PBM type). More...
template<class T >
int | SPL::encodePgm (std::ostream &outStream, const Array2< T > &gray, int maxVal, bool sgnd, bool binaryFormat=true)
| Output the array as an image in the PNM format (PGM type). More...
template<class T >
int | SPL::encodePpm (std::ostream &outStream, const Array2< T > &red, const Array2< T > &green, const Array2< T > &blue, int maxVal, bool sgnd, bool binaryFormat=true)
| Output the array as an image in the PNM format (PPM type). More...
template<class T >
int | SPL::decodePnm (std::istream &inStream, std::vector< Array2< T > > &comps, int &maxVal, bool &sgnd)
| Input an array as an image in the PNM format. More...
template<class T >
int | SPL::decodePbm (std::istream &inStream, Array2< T > &bits)
| Input an array as an image in the PNM format. More...
template<class T >
int | SPL::decodePgm (std::istream &inStream, Array2< T > &gray, int &maxVal, bool &sgnd)
| Input an array as an image in the PNM format. More...
template<class T >
int | SPL::decodePpm (std::istream &inStream, Array2< T > &red, Array2< T > &green, Array2< T > &blue, int &maxVal, bool &sgnd)
| Input an array as an image in the PNM format. More...

## Detailed Description

Image file I/O support.

## Function Documentation

template<class T >

int SPL::decodePbm | ( | std::istream & | inStream,
|  | Array2< T > & | bits
| ) |  |

Input an array as an image in the PNM format.

Effects: A binary image in the PBM format is read from the stream inStream. The parameter bits is set to the image read. The image to be read must be of the PBM type (i.e., binary).

Returns: Upon success, zero is returned; otherwise, a nonzero value is returned.

template<class T >

int SPL::decodePgm | ( | std::istream & | inStream,
|  | Array2< T > & | gray,
|  | int & | maxVal,
|  | bool & | sgnd
| ) |  |

Input an array as an image in the PNM format.

Effects: A grayscale image in the PGM format is read from the stream inStream. The parameter gray is updated to hold the image read. The parameter maxVal is set to the maximum value for the image sample data. The parameter sgnd is set to indicate whether the image data is signed. The image to be read must be of the PGM type (i.e., grayscale).

Returns: Upon success, zero is returned; otherwise, a nonzero value is returned.

template<class T >

int SPL::decodePnm | ( | std::istream & | inStream,
|  | std::vector< Array2< T > > & | comps,
|  | int & | maxVal,
|  | bool & | sgnd
| ) |  |

Input an array as an image in the PNM format.

Effects: An image in the PNM format is read from the stream inStream. The parameter comps is updated to hold the components of the image read, where the red, green, and blue color components are placed in comps[0], comps[1], and comps[2], respectively. The parameter maxVal is set to the maximum value for the image sample data. The parameter sgnd is set to indicate whether the image data is signed.

Returns: Upon success, zero is returned; otherwise, a nonzero value is returned.

template<class T >

int SPL::decodePpm | ( | std::istream & | inStream,
|  | Array2< T > & | red,
|  | Array2< T > & | green,
|  | Array2< T > & | blue,
|  | int & | maxVal,
|  | bool & | sgnd
| ) |  |

Input an array as an image in the PNM format.

Effects: A color image in the PPM format is read from the stream inStream. The parameters red, green, and blue are set to RGB components of the image read. The parameter maxVal is set to the maximum value for the image sample data. The parameter sgnd is set to indicate whether the image data is signed. The image to be read must be of the PPM type (i.e., RGB color).

Returns: Upon success, zero is returned; otherwise, a nonzero value is returned.

template<class T >

int SPL::encodePbm | ( | std::ostream & | outStream,
|  | const Array2< T > & | bits,
|  | bool | binaryFormat = `true`
| ) |  |

Output the array as an image in the PNM format (PBM type).

Effects: The binary image in the array bits is written to the stream outStream. If the parameter binaryFormat is true, the binary variant of the PBM format is used; otherwise, the text variant is employed.

Returns: Upon success, zero is returned; otherwise, a nonzero value is returned.

template<class T >

int SPL::encodePgm | ( | std::ostream & | outStream,
|  | const Array2< T > & | gray,
|  | int | maxVal,
|  | bool | sgnd,
|  | bool | binaryFormat = `true`
| ) |  |

Output the array as an image in the PNM format (PGM type).

Effects: The grayscale image in the array gray is written to the stream outStream. If the parameter binaryFormat is true, the binary variant of the PBM format is used; otherwise, the text variant is employed. The parameter maxVal specifies the maximum value for sample data. The parameter sgnd specified if the sample data is signed.

Returns: Upon success, zero is returned; otherwise, a nonzero value is returned.

template<class T >

int SPL::encodePnm | ( | std::ostream & | outStream,
|  | const std::vector< Array2< T > > & | comps,
|  | int | maxVal,
|  | bool | sgnd,
|  | bool | binaryFormat = `true`
| ) |  |

Output the array as an image in the PNM format.

Effects: The image components comps are written to the stream outStream in the PNM format, where the red, green, and blue color componenets are given by comps[0], comps[1], and comps[2], respectively. If the parameter binaryFormat is true, the binary variant of the PNM format is used; otherwise, the text variant is used. The parameter maxVal specifies the maximum value for sample data. The parameter sgnd specified if the sample data is signed.

Returns: Upon success, zero is returned; otherwise, a nonzero value is returned.

template<class T >

int SPL::encodePpm | ( | std::ostream & | outStream,
|  | const Array2< T > & | red,
|  | const Array2< T > & | green,
|  | const Array2< T > & | blue,
|  | int | maxVal,
|  | bool | sgnd,
|  | bool | binaryFormat = `true`
| ) |  |

Output the array as an image in the PNM format (PPM type).

Effects: The color image with RGB color planes in the arrays red, green, and blue, respectively, is written to the stream outStream. If the parameter binaryFormat is true, the binary variant of the PBM format is used; otherwise, the text variant is employed. The parameter maxVal specifies the maximum value for sample data. The parameter sgnd specified if the sample data is signed.

Returns: Upon success, zero is returned; otherwise, a nonzero value is returned.