LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::saveImage Class Reference

This class is used to save lti::image or lti::channel objects in files of one of the formats supported by the LTI-Lib. More...

#include <ltiALLFunctor.h>

Inheritance diagram for lti::saveImage:
Inheritance graph
[legend]
Collaboration diagram for lti::saveImage:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 saveImage ()
 ~saveImage ()
virtual const char * getTypeName () const
bool apply (const image &theImage)
bool apply (const channel &theChannel)
bool apply (const channel8 &theChannel, const lti::palette &colors=emptyPalette)
bool save (const std::string &filename, const image &theImage)
bool save (const std::string &filename, const channel8 &theChannel, const lti::palette &colors=emptyPalette)
bool save (const std::string &filename, const channel &theChannel)
virtual functorclone () const

Protected Attributes

lti::saveBMP saverBMP
lti::saveJPEG saverJPEG
lti::savePNG saverPNG

Detailed Description

This class is used to save lti::image or lti::channel objects in files of one of the formats supported by the LTI-Lib.

The save methods will use the extension in the filename to decide the format that should be used to save the image.

Three formats are supported: PNG, BMP and JPEG.

Example:

 lti::saveImage saver; // functor to save images
 lti::image img;       // the image to be saved

 // ... create an image somehow ...

 saver.save("myimage.png",img);  // save as PNG
 saver.save("myimage.bmp",img);  // save as BMP
 saver.save("myimage.jpg",img);  // save as JPEG

The valid extensions are case insensitive matches for .jpg, .jpeg, .png and .bmp.


Constructor & Destructor Documentation

lti::saveImage::saveImage (  ) 

default constructor

lti::saveImage::~saveImage (  )  [inline]

destructor


Member Function Documentation

bool lti::saveImage::apply ( const channel8 theChannel,
const lti::palette colors = emptyPalette 
) [virtual]

save 8-bit channel as a gray-valued bitmap or as an indexed image.

The name of the file is taken from the parameters.

Parameters:
theChannel the channel to be saved
colors if a color palette is given, theChannel will be considered to contain indices to this palette. If nothing (or an empty palette) is given, theChannel will be considered as a gray valued channel.
Returns:
true if successful, false otherwise

Reimplemented from lti::ioFunctor.

bool lti::saveImage::apply ( const channel theChannel  )  [virtual]

save float channel as a gray-valued image.

The name of the file is taken from the parameters.

Parameters:
theChannel channel to be stored. This channel must contain values between 0.0f and 1.0f.
Returns:
true if successful, false otherwise

Reimplemented from lti::ioFunctor.

bool lti::saveImage::apply ( const image theImage  )  [virtual]

save image.

Parameters:
theImage the image to be stored.

Reimplemented from lti::ioFunctor.

virtual functor* lti::saveImage::clone (  )  const [virtual]

returns a pointer to a clone of the functor.

Implements lti::functor.

virtual const char* lti::saveImage::getTypeName (  )  const [virtual]

returns the name of this type

Reimplemented from lti::ioImage.

bool lti::saveImage::save ( const std::string &  filename,
const channel theChannel 
)

This will save a channel as an 8 bit RGB bitmap image.

The values of the channel must be between 0.0f and 1.0f!

Parameters:
filename the name for the image file. Its extention will determine the format to be used. The valid extensions are case insensitive matches for .jpg, .jpeg, .png * and .bmp.
theChannel the channel to be save
bool lti::saveImage::save ( const std::string &  filename,
const channel8 theChannel,
const lti::palette colors = emptyPalette 
) [virtual]

This will save a channel8 as an 8 bit RGB bitmap image.

Parameters:
filename the name for the image file. Its extention will determine the format to be used. The valid extensions are case insensitive matches for .jpg, .jpeg, .png * and .bmp.
theChannel the channel to be save
colors the palette to be used (see apply(const channel& theChannel) for details)

Reimplemented from lti::ioFunctor.

bool lti::saveImage::save ( const std::string &  filename,
const image theImage 
) [virtual]

This will save an image as a 24 bit RGB bitmap image.

Parameters:
filename the name for the image file. Its extention will determine the format to be used. The valid extensions are case insensitive matches for .jpg, .jpeg, .png * and .bmp.
theImage the image to be written.
Returns:
true if successful, false otherwise

Reimplemented from lti::ioFunctor.


Member Data Documentation

functor to save BMP images

functor to save JPEG images

functor to save PNG images


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

Generated on Sat Apr 10 15:27:59 2010 for LTI-Lib by Doxygen 1.6.1