[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
![]() |
Image Import/Export Facilities | ![]() |
Classes | |
class | ImageExportInfo |
Argument object for the function exportImage(). More... | |
class | ImageImportInfo |
Argument object for the function importImage(). More... | |
Functions | |
template<... > | |
void | exportImage (...) |
Write an image given a vigra::ImageExportInfo object. | |
template<... > | |
void | exportImageAlpha (...) |
Write the image specified by the given vigra::ImageExportInfo object including an alpha channel. | |
std::string | impexListExtensions () |
List the file extension VIGRA understands. | |
std::string | impexListFormats () |
List the image formats VIGRA can read and write. | |
template<... > | |
void | importImage (...) |
Read the image specified by the given vigra::ImageImportInfo object. | |
template<... > | |
void | importImageAlpha (...) |
Read the image specified by the given vigra::ImageImportInfo object including its alpha channel. | |
bool | isImage (char const *filename) |
Test whether a file is an image format known to VIGRA. |
supports GIF, TIFF, JPEG, BMP, EXR, HDR, PNM (PBM, PGM, PPM), PNG, SunRaster, KHOROS-VIFF formats
std::string vigra::impexListFormats | ( | ) |
List the image formats VIGRA can read and write.
This is useful for creating error messages if VIGRA encounters an image format it doesn't recognize.
Usage:
#include <vigra/imageinfo.hxx>
Namespace: vigra
std::cout << "supported formats: " << vigra::impexListFormats() << std::endl;
std::string vigra::impexListExtensions | ( | ) |
List the file extension VIGRA understands.
This is useful for creating file dialogs that only list image files VIGRA can actually import.
Usage:
#include <vigra/imageinfo.hxx>
Namespace: vigra
std::cout << "supported extensions: " << vigra::impexListExtensions() << std::endl;
bool vigra::isImage | ( | char const * | filename | ) |
Test whether a file is an image format known to VIGRA.
This checks the first few bytes of the file and compares them with the "magic strings" of each recognized image format.
Usage:
#include <vigra/imageinfo.hxx>
Namespace: vigra
std::cout << "is image: " << vigra::isImage("foo.bmp") << std::endl;
void vigra::importImage | ( | ... | ) |
Read the image specified by the given vigra::ImageImportInfo object.
Declarations
Pass arguments explicitly:
namespace vigra { template <class ImageIterator, class Accessor> void importImage(const ImageImportInfo& importInfo, ImageIterator imageIterator, Accessor imageAccessor) }
Use argument objects in conjunction with Argument Object Factories :
namespace vigra { template <class ImageIterator, class Accessor> inline void importImage(const ImageImportInfo& importInfo, const pair<ImageIterator, Accessor>& image) }
Usage
#include <vigra/impex.hxx>
Namespace: vigra
ImageImportInfo info("myimage.gif"); if (info.isGrayscale()) { // create byte image of appropriate size BImage image(info.width(), info.height()); importImage(info, destImage(image)); ... } else { // create byte RGB image of appropriate size BRGBImage image(info.width(), info.height()); importImage(info, destImage(image)); ... }
Preconditions
| Type | Extension | Name | Support Library | |------|-----------|------------------------------------------------------------|-----------------| | BMP | bmp | Microsoft Windows bitmap image file | | | EXR | exr | OpenEXR high dynamic range image format | libopenexr | | GIF | gif | CompuServe graphics interchange format, 8-bit color | | | HDR | hdr | Radiance RGBE high dynamic range image format | libexr? | | JPEG | jpg, jpeg | Joint Photographic Experts Group JFIF format, 24-bit color | libjpeg | | PBM | pbm | Portable bitmap format (black and white) | | | PGM | pgm | Portable graymap format (gray scale) | | | PNG | png | Portable Network Graphic | libpng | | PNM | pnm | Portable anymap | | | PPM | ppm | Portable pixmap format (color) | | | SUN | ras | SUN Rasterfile | | | TIFF | tif, tiff | Tagged Image File Format | libtiff | | VIFF | xv | Khoros Visualization image file | |
void vigra::exportImage | ( | ... | ) |
Write an image given a vigra::ImageExportInfo object.
If the file format to be exported to supports the pixel type of the source image, the pixel type will be kept (e.g. float
can be stored as TIFF without conversion, in contrast to most other image export toolkits). Otherwise, the pixel values are transformed to the range 0..255 and converted to unsigned char
. Currently, the following file formats are supported. The pixel types given in brackets are those that are written without conversion:
Declarations
Pass arguments explicitly:
namespace vigra { template <class ImageIterator, class ImageAccessor> void exportImage(ImageIterator imageUpperLeft, ImageIterator imageLowerRight, ImageAccessor imageAccessor, const ImageExportInfo& exportInfo) }
Use argument objects in conjunction with Argument Object Factories :
namespace vigra { template <class ImageIterator, class ImageAccessor> void exportImage(ImageIterator imageUpperLeft, ImageIterator imageLowerRight, ImageAccessor imageAccessor, const ImageExportInfo& exportInfo) }
Usage
#include <vigra/impex.hxx>
Namespace: vigra
BRGBImage image(width, height); ... // write as JPEG image, using compression quality 80 exportImage(srcImageRange(image), ImageExportInfo("my-image.jpg").setCompression("80")); // Force it to a particular pixel type. The pixel type must be supported by the // desired image file format, otherwise an \ref vigra::PreconditionViolation // exception will be thrown. exportImage(srcImageRange(image), ImageExportInfo("my-INT16-image.tif").setPixelType("INT16"));
Preconditions
void vigra::importImageAlpha | ( | ... | ) |
Read the image specified by the given vigra::ImageImportInfo object including its alpha channel.
Declarations
Pass arguments explicitly:
namespace vigra { template <class ImageIterator, class ImageAccessor, class AlphaIterator, class AlphaAccessor> void importImageAlpha(const ImageImportInfo& importInfo, ImageIterator imageIterator, ImageAccessor imageAccessor, AlphaIterator alphaIterator, AlphaAccessor alphaAccessor) }
Use argument objects in conjunction with Argument Object Factories :
namespace vigra { template <class ImageIterator, class ImageAccessor, class AlphaIterator, class AlphaAccessor> void importImageAlpha(const ImageImportInfo& importInfo, const pair<ImageIterator, ImageAccessor>& image, const pair<AlphaIterator, AlphaAccessor>& alpha) }
Usage
#include <vigra/impexalpha.hxx>
Namespace: vigra
typedef UInt8 value_t; ImageImportInfo info("zorro.tif"); if (info.isGrayscale()) { BasicImage<value_t> alpha(info.size()); BasicImage<value_t> image(info.size()); importImageAlpha(info, image.upperLeft(), image.accessor(), alpha.upperLeft(), alpha.accessor()); ... } else { BasicImage<value_t> alpha(info.size()); BasicImage<vigra::RGBValue<value_t> > image(info.size()); importImageAlpha(info, image.upperLeft(), image.accessor(), alpha.upperLeft(), alpha.accessor()); ... }
Preconditions
void vigra::exportImageAlpha | ( | ... | ) |
Write the image specified by the given vigra::ImageExportInfo object including an alpha channel.
Declarations
Pass arguments explicitly:
namespace vigra { template <class ImageIterator, class ImageAccessor, class AlphaIterator, class AlphaAccessor> void exportImageAlpha(ImageIterator imageUpperLeft, ImageIterator imageLowerRight, ImageAccessor imageAccessor, AlphaIterator alphaUpperLeft, AlphaAccessor alphaAccessor, const ImageExportInfo& exportInfo) }
Use argument objects in conjunction with Argument Object Factories :
namespace vigra { template <class ImageIterator, class ImageAccessor, class AlphaIterator, class AlphaAccessor> void exportImageAlpha(const triple<ImageIterator, ImageIterator, ImageAccessor>& image, const pair<AlphaIterator, AlphaAccessor>& alpha, const ImageExportInfo& exportInfo) }
Usage
#include <vigra/impexalpha.hxx>
Namespace: vigra
typedef UInt8 value_t; ImageExportInfo info("zorro.tif"); if (info.isGrayscale()) { BasicImage<value_t> alpha; BasicImage<value_t> image; ... exportImageAlpha(image.upperLeft(), image.lowerRight(), image.accessor(), alpha.upperLeft(), alpha.accessor(), info); } else { BasicImage<value_t> alpha; BasicImage<vigra::RGBValue<value_t> > image; ... exportImageAlpha(image.upperLeft(), image.lowerRight(), image.accessor(), alpha.upperLeft(), alpha.accessor(), info); }
Preconditions
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|