Wavelet and Image class library  1.3.2
Enumerations | Functions
MagickInter Namespace Reference

Enumerations

enum  TransparencyBackground { NONE, WHITE, BLACK }

Functions

Magick::Image magickImageFromColorImageWithTransparency (ColorImage &img, bool withTransparency=false, coeff *transparentColors=NULL, int colorBytes=1)
Magick::Image magickImageFromColorImage (ColorImage &img)
std::auto_ptr< ColorImagecolorImageFromMagickImage (Magick::Image &img)
std::auto_ptr< ColorImageobtainColorImage (const std::string &inFile, const TransparencyBackground &transparencyBackground=NONE)
void writeColorImage (ColorImage &img, const std::string &outFile, int quality=100)
void writeColorImageWithTransparency (ColorImage &img, const std::string &outFile, int quality=100, bool withTransparency=false, coeff *transparentColors=NULL, int colorBytes=1)
void scaleAndWriteColorImage (ColorImage &img, int rows, int cols, const std::string &outFile, int quality=100)

Detailed Description

Helper functions for extended read/write support using the Magick++ classes. This is motivated by the fact that we want to support many, many file formats but don't want to spend our time writing import and export filters. The implementation is quite rudimentary. All conversion is done by saving and loading temporary files. Also, naturally (as the Wavelet lib does not have support for this), all meta-information like e.g. transparency is lost.


Enumeration Type Documentation

Enumerator:
NONE 
WHITE 
BLACK 

Definition at line 32 of file MagickInter.hh.


Function Documentation

std::auto_ptr<ColorImage> MagickInter::colorImageFromMagickImage ( Magick::Image &  img)

Converts a Magick::Image to a ColorImage.

Parameters:
imgthe Magick::Image object
Returns:
an auto_ptr to the corresponding ColorImage
Exceptions:
ios_base:failureif an I/O operation did not succeed (e.g. non-existent file, insufficient disk space etc.)
invalid_argumentfor logical errors (e.g. unknown image file format etc.)

Converts a ColorImage to a Magick::Image.

Parameters:
imgthe ColorImage object
Returns:
a corresponding Magick::Image
Exceptions:
ios_base:failureif an I/O operation did not succeed (e.g. non-existent file, insufficient disk space etc.)
invalid_argumentfor logical errors (e.g. unknown image file format etc.)
Magick::Image MagickInter::magickImageFromColorImageWithTransparency ( ColorImage img,
bool  withTransparency = false,
coeff transparentColors = NULL,
int  colorBytes = 1 
)

Converts a ColorImage to a Magick::Image.

Parameters:
imgthe ColorImage object
withTransparencyif set to true, the returned image will contain transparency information according to the original image's colors. NOTE: this will only work with 3-color images using RGB color model.
transparentColorsan array of as many members as the image has color channels. If at a given position the original image's pixel n-tuple has identical values, the pixel will be considered transparent. The default value NULL stands for { -1, -1, -1 }
colorBytesthe number of bytes per pixel (usually 1, i.e. 256 distinct colors)
Returns:
a corresponding Magick::Image
Exceptions:
ios_base:failureif an I/O operation did not succeed (e.g. non-existent file, insufficient disk space etc.)
invalid_argumentfor logical errors (e.g. unknown image file format etc.)
std::auto_ptr<ColorImage> MagickInter::obtainColorImage ( const std::string &  inFile,
const TransparencyBackground &  transparencyBackground = NONE 
)

Creates a ColorImage object for an image in the file system using the Magick classes.

Parameters:
inFilethe input file name
transparencyBackgroundif not NONE, enforce WHITE or BLACK for pixels marked as transparent in the image
Returns:
an auto_ptr to the new ColorImage
Exceptions:
ios_base:failureif an I/O operation did not succeed (e.g. non-existent file, insufficient disk space etc.)
invalid_argumentfor logical errors (e.g. unknown image file format etc.)
void MagickInter::scaleAndWriteColorImage ( ColorImage img,
int  rows,
int  cols,
const std::string &  outFile,
int  quality = 100 
)

Rescales and then writes a ColorImage to any file format using the Magick classes.

Parameters:
imgthe ColorImage object
rowsthe target number of image rows
colsthe target number of image cols
outFilethe output file name
qualitythe quality (e.g. JPEG quality) if applicable
Exceptions:
ios_base:failureif an I/O operation did not succeed (e.g. non-existent file, insufficient disk space etc.)
invalid_argumentfor logical errors (e.g. unknown image file format etc.)
void MagickInter::writeColorImage ( ColorImage img,
const std::string &  outFile,
int  quality = 100 
)

Writes a ColorImage to any file format using the Magick classes.

Parameters:
imgthe ColorImage object
outFilethe output file name
qualitythe quality (e.g. JPEG quality) if applicable
Exceptions:
ios_base:failureif an I/O operation did not succeed (e.g. non-existent file, insufficient disk space etc.)
invalid_argumentfor logical errors (e.g. unknown image file format etc.)
void MagickInter::writeColorImageWithTransparency ( ColorImage img,
const std::string &  outFile,
int  quality = 100,
bool  withTransparency = false,
coeff transparentColors = NULL,
int  colorBytes = 1 
)

Writes a ColorImage to any file format using the Magick classes. This does not use the usual export/import approach but creates an intermediate Magick image from the scratch. However it should be noted that the result may differ slightly from the source image due to Magick's quantization.

Parameters:
imgthe ColorImage object
outFilethe output file name
qualitythe quality (e.g. JPEG quality) if applicable
withTransparencyif set to true, the returned image will contain transparency information according to the original image's colors. NOTE: this will only work with 3-color images using RGB color model.
transparentColorsan array of as many members as the image has color channels. If at a given position the original image's pixel n-tuple has identical values, the pixel will be considered transparent. The default value NULL stands for { -1, -1, -1 }
colorBytesthe number of bytes per pixel (usually 1, i.e. 256 distinct colors)
Exceptions:
ios_base:failureif an I/O operation did not succeed (e.g. non-existent file, insufficient disk space etc.)
invalid_argumentfor logical errors (e.g. unknown image file format etc.)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines