latest version v1.9 - last update 10 Apr 2010 |
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>
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 functor * | clone () const |
Protected Attributes | |
lti::saveBMP | saverBMP |
lti::saveJPEG | saverJPEG |
lti::savePNG | saverPNG |
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.
lti::saveImage::saveImage | ( | ) |
default constructor
lti::saveImage::~saveImage | ( | ) | [inline] |
destructor
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.
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. |
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.
theChannel | channel to be stored. This channel must contain values between 0.0f and 1.0f. |
Reimplemented from lti::ioFunctor.
bool lti::saveImage::apply | ( | const image & | theImage | ) | [virtual] |
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 | |||
) |
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.
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.
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. |
Reimplemented from lti::ioFunctor.
lti::saveBMP lti::saveImage::saverBMP [protected] |
functor to save BMP images
lti::saveJPEG lti::saveImage::saverJPEG [protected] |
functor to save JPEG images
lti::savePNG lti::saveImage::saverPNG [protected] |
functor to save PNG images