vigra - ImageExportInfo Class Reference

[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

| ImageExportInfo Class Reference Image Import/Export Facilities |

Argument object for the function exportImage(). More...

`#include <vigra/imageinfo.hxx>`

## Public Types
typedef ArrayVector< unsigned char > | ICCProfile

## Public Member Functions
Size2D | getCanvasSize () const
const ICCProfile & | getICCProfile () const
const char * | getMode () const
const char * | getPixelType () const
Diff2D | getPosition () const
| ImageExportInfo (const char *filename, const char *mode="w")
ImageExportInfo & | setCanvasSize (const Size2D &size)
ImageExportInfo & | setCompression (const char *type)
ImageExportInfo & | setFileName (const char *filename)
ImageExportInfo & | setFileType (const char *)
ImageExportInfo & | setICCProfile (const ICCProfile &profile)
ImageExportInfo & | setPixelType (const char *)
ImageExportInfo & | setPosition (const Diff2D &pos)
ImageExportInfo & | setXResolution (float)
ImageExportInfo & | setYResolution (float)

## Detailed Description

Argument object for the function exportImage().

See exportImage() for usage example. This object must be used to define the properties of an image to be written to disk.

#include <vigra/imageinfo.hxx>
Namespace: vigra

Examples:
  boundarytensor.cxx, composite.cxx, convert.cxx, dissolve.cxx, edge.cxx, imageExportInfo_tutorial.cxx, imageIO_tutorial.cxx, invert.cxx, invert_explicitly.cxx, invert_tutorial.cxx, mirror_tutorial.cxx, palette.cxx, profile.cxx, pyramid.cxx, resize.cxx, smooth.cxx, smooth_convolve.cxx, smooth_explicitly.cxx, subimage.cxx, subimage_tutorial.cxx, total_variation.cxx, voronoi.cxx, and watershed.cxx.

## Member Typedef Documentation

typedef ArrayVector<unsigned char> ICCProfile

ICC profiles (handled as raw data so far). see getICCProfile()/setICCProfile()

## Constructor & Destructor Documentation

ImageExportInfo | ( | const char * | filename,
|  | const char * | mode = `"w"`
| ) |  |

Construct ImageExportInfo object.

The image will be stored under the given filename. The file type will be guessed from the extension unless overridden by setFileType(). Recognized extensions: '.bmp', '.exr', '.gif', '.jpeg', '.jpg', '.p7', '.png', '.pbm', '.pgm', '.pnm', '.ppm', '.ras', '.tif', '.tiff', '.xv', '.hdr'.

EXR support requires libopenexr, JPEG support requires libjpeg, PNG support requires libpng and TIFF support requires libtiff.

If the data is exported to TIFF, the mode may be "a", in which case the exported image is appended to the existing file, resulting in a multi-page TIFF image.

## Member Function Documentation

ImageExportInfo& setFileName | ( | const char * | filename | ) |

Set image file name.

The file type will be guessed from the extension unless overridden by setFileType(). Recognized extensions: '.bmp', '.exr', '.gif', '.jpeg', '.jpg', '.p7', '.png', '.pbm', '.pgm', '.pnm', '.ppm', '.ras', '.tif', '.tiff', '.xv', '.hdr'. EXR support requires libopenexr, JPEG support requires libjpeg, PNG support requires libpng and TIFF support requires libtiff.

const char* getMode | ( |  | ) | const

Return the image file opening mode.

ImageExportInfo& setFileType | ( | const char * |  | ) |

Store image as given file type.

This will override any type guessed from the file name's extension. Recognized file types:

BMP:
  Microsoft Windows bitmap image file.
EXR:
  OpenEXR high dynamic range image format. (only available if libopenexr is installed)
GIF:
  CompuServe graphics interchange format; 8-bit color.
HDR:
  Radiance RGBE high dynamic range image format.
JPEG:
  Joint Photographic Experts Group JFIF format; compressed 24-bit color (only available if libjpeg is installed).
PNG:
  Portable Network Graphic (only available if libpng is installed).
PBM:
  Portable bitmap format (black and white).
PGM:
  Portable graymap format (gray scale).
PNM:
  Portable anymap.
PPM:
  Portable pixmap format (color).
SUN:
  SUN Rasterfile.
TIFF:
  Tagged Image File Format. (only available if libtiff is installed.)
VIFF:
  Khoros Visualization image file.

With the exception of TIFF, VIFF, PNG, and PNM all file types store only 1 byte (gray scale and mapped RGB) or 3 bytes (RGB) per pixel.

PNG can store UInt8 and UInt16 values, and supports 1 and 3 channel images. One additional alpha channel is also supported.

PNM can store 1 and 3 channel images with UInt8, UInt16 and UInt32 values in each channel.

TIFF and VIFF are additionally able to store short and long integers (2 or 4 bytes) and real values (32 bit float and 64 bit double) without conversion. So you will need to use TIFF or VIFF if you need to store images with high accuracy (the appropriate type to write is automatically derived from the image type to be exported). However, many other programs using TIFF (e.g. ImageMagick) have not implemented support for those pixel types. So don't be surprised if the generated TIFF is not readable in some cases. If this happens, export the image as 'unsigned char' or 'RGBValue<unsigned char>' by calling ImageExportInfo::setPixelType().

Support to reading and writing ICC color profiles is provided for TIFF, JPEG, and PNG images.

ImageExportInfo& setCompression | ( | const char * | type | ) |

Set compression type and quality.

This option is ignored when the target file format doesn't recognize the compression type. Valid arguments:

NONE:
  (recognized by EXR and TIFF): do not compress (many other formats don't compress either, but it is not an option for them).
JPEG:
  (recognized by JPEG and TIFF): use JPEG compression. You can also specify a compression quality parameter by passing "JPEG QUALITY=N", where "N" must be an integer between 1 and 100 (e.g. "JPEG QUALITY=70").
JPEG-ARITH:
  (recognized by new versions of JPEG): use arithmetic coding as a back-end after JPEG compression (by default, the back-end is Huffman coding). You can also specify a compression quality parameter by passing "JPEG-ARITH QUALITY=N", where "N" must be an integer between 1 and 100 (e.g. "JPEG-ARITH QUALITY=70").
RLE, RunLength:
  (recognized by EXR and TIFF): use run-length encoding. (BMP also uses run-length encoding, but there it is not an option).
PACKBITS:
  (recognized by TIFF): use packbits encoding (a variant of RLE).
DEFLATE:
  (recognized by TIFF): use deflate encoding, as defined in zlib (PNG also uses deflate, but there it is not an option).
LZW:
  (recognized by TIFF): use Lempel-Ziv-Welch encoding.
ZIP:
  (recognized by EXR): use zip-style encoding.
PIZ:
  (recognized by EXR): use wavelet encoding.
PXR24:
  (recognized by EXR): reduce to 24-bit, then use zip-style encoding.
B44, B44A:
  (recognized by EXR): see OpenEXR documentation.
ASCII:
  (recognized by PNM): store pixels as ASCII (human readable numbers).
RAW:
  (recognized by PNM): store pixels as uncompressed binary data.
BILEVEL:
  (recognized by PNM): store as one bit per pixel.
1 ... 100:
  deprecated (equivalent to `setCompression("JPEG QUALITY=number")` where the number denotes the desired quality).

Some of these options (e.g. "JPEG-ARITH", "LZW", "B44", "B44A") may only be available when they have been enabled in the corresponding third-party library.

ImageExportInfo& setPixelType | ( | const char * |  | ) |

Set the pixel type of the image file. Possible values are:

UINT8:
  8-bit unsigned integer (unsigned char)
INT16:
  16-bit signed integer (short)
UINT16:
  16-bit unsigned integer (unsigned short)
INT32:
  32-bit signed integer (long)
UINT32:
  32-bit unsigned integer (unsigned long)
FLOAT:
  32-bit floating point (float)
DOUBLE:
  64-bit floating point (double)

Usage:

FImage img(w,h);
// by default, float images are exported with pixeltype float
// when the target format support this type, i.e. is TIFF or VIFF.
exportImage(srcImageRange(img), ImageExportInfo("asFloat.tif"));
// if this is not desired, force a different pixeltype
exportImage(srcImageRange(img), ImageExportInfo("asByte.tif").setPixelType("UINT8"));

const char* getPixelType | ( |  | ) | const

Get the pixel type of the image. Possible values are:

UINT8:
  8-bit unsigned integer (unsigned char)
INT16:
  16-bit signed integer (short)
INT32:
  32-bit signed integer (long)
FLOAT:
  32-bit floating point (float)
DOUBLE:
  64-bit floating point (double)

ImageExportInfo& setXResolution | ( | float |  | ) |

Set the image resolution in horizontal direction

ImageExportInfo& setYResolution | ( | float |  | ) |

Set the image resolution in vertical direction

ImageExportInfo& setPosition | ( | const Diff2D & | pos | ) |

Set the position of the upper Left corner on a global canvas.

Currently only supported by TIFF, PNG and OpenEXR files.

The offset is encoded in the XPosition and YPosition TIFF tags. TIFF requires that the resolution must also be set.

Parameters

  pos | position of the upper left corner in pixels (must be >= 0 for TIFF)

Diff2D getPosition | ( |  | ) | const

Get the position of the upper left corner on a global canvas.

Size2D getCanvasSize | ( |  | ) | const

Get the size of the canvas, on which the image is positioned at getPosition()

ImageExportInfo& setCanvasSize | ( | const Size2D & | size | ) |

Get the size of the canvas, on which the image is positioned at getPosition()

const ICCProfile& getICCProfile | ( |  | ) | const

Returns a reference to the ICC profile.

ImageExportInfo& setICCProfile | ( | const ICCProfile & | profile | ) |

Sets the ICC profile. ICC profiles are currently supported by TIFF, PNG and JPEG images. (Otherwise, the profile data is silently ignored.)

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

- vigra/imageinfo.hxx

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.11.0 (Fri May 19 2017)