Public Types | Static Public Member Functions | Static Public Attributes | List of all members
FilePnm Class Reference

For reading and writing images in PNM format. More...

#include <FilePnm.h>

Inheritance diagram for FilePnm:
Inheritance graph
[legend]
Collaboration diagram for FilePnm:
Collaboration graph
[legend]

Public Types

enum  FileType {
  UNDEFINED =0 , PBM_ASC =1 , PGM_ASC =2 , PPM_ASC =3 ,
  PBM_RAW =4 , PGM_RAW =5 , PPM_RAW =6
}
 

Static Public Member Functions

static void read (Image &image, const std::string &path)
 Reads a pnm file to an image. More...
 
static FileType readHeader (drain::image::ImageConf &conf, drain::FlexVariableMap &properties, std::istream &infile)
 Read image array after essential metadata (type and geometry) has been processed.
 
static void readFrame (ImageFrame &image, const std::string &path)
 Read image array, assuming type and geometry already set.
 
static void readFrame (ImageFrame &image, std::istream &infile, FileType fileType=PGM_RAW)
 Read image array after essential metadata (type and geometry) has been processed. More...
 
static void write (const ImageFrame &image, const std::string &path)
 Read image array after essential metadata (type and geometry) has been processed. More...
 

Static Public Attributes

static const FileInfo fileInfo
 Syntax for recognising pnm files. More...
 

Detailed Description

For reading and writing images in PNM format.

A lighter alternative for Magick++ which supports tens of image formats. Portable N M ? (PNM) format is an old yet flexible image format for gray level and color images.

Member Function Documentation

◆ read()

void read ( Image image,
const std::string &  path 
)
static

Reads a pnm file to an image.

Converts indexed (palette) images to RGB or RGBA. Scales data to 8 or 16 bits, according to template class. Floating point images will be scaled as 16 bit integral (unsigned short int).

In addition to reading to Image, supports reading to ImageFrame if type and geometry match.

Template Parameters
T- Image or ImageFrame

◆ readFrame()

void readFrame ( ImageFrame image,
std::istream &  infile,
FileType  fileType = PGM_RAW 
)
static

Read image array after essential metadata (type and geometry) has been processed.

Writes drain::Image to a png image file applying G,GA, RGB or RGBA color model. Writes in 8 or 16 bits, according to template class. Floating point images will be scaled as 16 bit integral (unsigned short int).

◆ write()

void write ( const ImageFrame image,
const std::string &  path 
)
static

Read image array after essential metadata (type and geometry) has been processed.

Writes image to a pgm binary file. Writes drain::Image to a png image file applying G,GA, RGB or RGBA color model. Writes in 8 or 16 bits, according to template class. Floating point images will be scaled as 16 bit integral (unsigned short int).

Parameters
image- image
pathPrefix-

Writes drain::Image to a png image file applying G,GA, RGB or RGBA color model. Writes in 8 or 16 bits, according to template class. Floating point images will be scaled as 16 bit integral (unsigned short int).

FILE HEADER

Member Data Documentation

◆ fileInfo

const drain::FileInfo fileInfo
static

Syntax for recognising pnm files.

Syntax for recognising PNM image files.


The documentation for this class was generated from the following files: