- Main Page
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# fipImage Class Reference

`#include <FreeImagePlus.h>`

Inheritance diagram for fipImage:

List of all members.

## Detailed Description

A class used to manage all photo related images and all image types used by the library.

fipImage encapsulates the FIBITMAP format. It relies on the FreeImage library, especially for loading / saving images and for bit depth conversion.

Version:
  FreeImage 3

Author:
  Hervé Drolon

## Public Member Functions
Creation & Destruction
| fipImage (FREE_IMAGE_TYPE image_type=FIT_BITMAP, WORD width=0, WORD height=0, WORD bpp=0)
| Constructor.
virtual | ~fipImage ()
| Destructor.
BOOL | setSize (FREE_IMAGE_TYPE image_type, WORD width, WORD height, WORD bpp, unsigned red_mask=0, unsigned green_mask=0, unsigned blue_mask=0)
| Image allocator.
virtual void | clear ()
| Destroy image data.
Copying
| fipImage (const fipImage &src)
| Copy constructor.
fipImage & | operator= (const fipImage &src)
| Copy constructor.
fipImage & | operator= (FIBITMAP *dib)
| Assignement operator</b> Copy the input pointer and manage its destruction
BOOL | copySubImage (fipImage &dst, int left, int top, int right, int bottom) const
BOOL | pasteSubImage (fipImage &src, int left, int top, int alpha=256)
BOOL | crop (int left, int top, int right, int bottom)
Loading & Saving
Loading and saving is handled by the FreeImage library.
BOOL | load (const char *lpszPathName, int flag=0)
BOOL | loadU (const wchar_t *lpszPathName, int flag=0)
| UNICODE version of load (this function only works under WIN32 and does nothing on other OS).
BOOL | loadFromHandle (FreeImageIO *io, fi_handle handle, int flag=0)
BOOL | loadFromMemory (fipMemoryIO &memIO, int flag=0)
BOOL | save (const char *lpszPathName, int flag=0) const
BOOL | saveU (const wchar_t *lpszPathName, int flag=0) const
| UNICODE version of save (this function only works under WIN32 and does nothing on other OS).
BOOL | saveToHandle (FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag=0) const
BOOL | saveToMemory (FREE_IMAGE_FORMAT fif, fipMemoryIO &memIO, int flag=0) const
Information functions
Accessors to the DIB BITMAPINFO structure.
FREE_IMAGE_TYPE | getImageType () const
| Returns the data type of the image.
WORD | getWidth () const
| Returns the image width in pixels.
WORD | getHeight () const
| Returns the image height in pixels.
WORD | getScanWidth () const
| Returns the width of the bitmap in bytes rounded to the nearest DWORD.
| operator FIBITMAP * ()
| Returns a pointer to the FIBITMAP data.
BOOL | isValid () const
| Returns TRUE if the image is allocated, FALSE otherwise.
BITMAPINFO * | getInfo () const
| Returns a pointer to the bitmap's BITMAPINFO header.
BITMAPINFOHEADER * | getInfoHeader () const
| Returns a pointer to the bitmap's BITMAPINFOHEADER.
LONG | getImageSize () const
| Returns the size of the bitmap in bytes.
WORD | getBitsPerPixel () const
| Returns the bitdepth of the bitmap.
WORD | getLine () const
| Returns the width of the bitmap in bytes.
double | getHorizontalResolution () const
| Returns the bitmap resolution along the X axis, in pixels / cm.
double | getVerticalResolution () const
| Returns the bitmap resolution along the Y axis, in pixels / cm.
void | setHorizontalResolution (double value)
| set the bitmap resolution along the X axis, in pixels / cm
void | setVerticalResolution (double value)
| set the bitmap resolution along the Y axis, in pixels / cm
Palette operations
RGBQUAD * | getPalette () const
| Returns a pointer to the bitmap's palette.
WORD | getPaletteSize () const
| Returns the palette size in bytes.
WORD | getColorsUsed () const
| Retrieves the number of colours used in the bitmap.
FREE_IMAGE_COLOR_TYPE | getColorType () const
| Investigates the colour type of the bitmap.
BOOL | isGrayscale () const
| Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise.
Pixel access
BYTE * | accessPixels () const
BYTE * | getScanLine (WORD scanline) const
BOOL | getPixelIndex (unsigned x, unsigned y, BYTE *value) const
| Get the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access).
BOOL | getPixelColor (unsigned x, unsigned y, RGBQUAD *value) const
| Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access).
BOOL | setPixelIndex (unsigned x, unsigned y, BYTE *value)
| Set the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access).
BOOL | setPixelColor (unsigned x, unsigned y, RGBQUAD *value)
| Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access).
Conversion routines
Bitmaps are always loaded in their default bit depth. If you want the bitmap to be stored in another bit depth, the class provides several conversion functions.
BOOL | convertToType (FREE_IMAGE_TYPE image_type, BOOL scale_linear=TRUE)
| Converts an image to a type supported by FreeImage.
BOOL | threshold (BYTE T)
| Converts the bitmap to 1 bit using a threshold T.
BOOL | dither (FREE_IMAGE_DITHER algorithm)
| Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm.
BOOL | convertTo4Bits ()
| Converts the bitmap to 4 bits.
BOOL | convertTo8Bits ()
| Converts the bitmap to 8 bits.
BOOL | convertToGrayscale ()
| Converts the bitmap to 8 bits.
BOOL | colorQuantize (FREE_IMAGE_QUANTIZE algorithm)
| Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap.
BOOL | convertTo16Bits555 ()
| Converts the bitmap to 16 bits.
BOOL | convertTo16Bits565 ()
| Converts the bitmap to 16 bits.
BOOL | convertTo24Bits ()
| Converts the bitmap to 24 bits.
BOOL | convertTo32Bits ()
| Converts the bitmap to 32 bits.
BOOL | convertToRGBF ()
| Converts the bitmap to a 96-bit RGBF image.
BOOL | toneMapping (FREE_IMAGE_TMO tmo, double first_param=0, double second_param=0, double third_param=1, double fourth_param=0)
| Converts a High Dynamic Range image (48-bit RGB or 96-bit RGB Float) to a 24-bit RGB image.
Transparency support: background colour and alpha channel
BOOL | isTransparent () const
| Returns TRUE if the image is transparent, returns FALSE otherwise.
unsigned | getTransparencyCount () const
| 8-bit transparency : get the number of transparent colors.
BYTE * | getTransparencyTable () const
| 8-bit transparency : get the bitmap’s transparency table.
void | setTransparencyTable (BYTE *table, int count)
| 8-bit transparency : set the bitmap’s transparency table.
BOOL | hasFileBkColor () const
| Returns TRUE when the image has a file background color, FALSE otherwise.
BOOL | getFileBkColor (RGBQUAD *bkcolor) const
BOOL | setFileBkColor (RGBQUAD *bkcolor)
Channel processing support
BOOL | getChannel (fipImage &image, FREE_IMAGE_COLOR_CHANNEL channel) const
BOOL | setChannel (fipImage &image, FREE_IMAGE_COLOR_CHANNEL channel)
BOOL | splitChannels (fipImage &RedChannel, fipImage &GreenChannel, fipImage &BlueChannel)
BOOL | combineChannels (fipImage &red, fipImage &green, fipImage &blue)
Rotation and flipping
BOOL | rotateEx (double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask)
| Image translation and rotation using B-Splines.
BOOL | rotate (double angle, const void *bkcolor=NULL)
| Image rotation by means of three shears.
BOOL | flipHorizontal ()
| Flip the image horizontally along the vertical axis.
BOOL | flipVertical ()
| Flip the image vertically along the horizontal axis.
Color manipulation routines
BOOL | invert ()
| Inverts each pixel data.
BOOL | adjustCurve (BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel)
BOOL | adjustGamma (double gamma)
BOOL | adjustBrightness (double percentage)
BOOL | adjustContrast (double percentage)
BOOL | adjustBrightnessContrastGamma (double brightness, double contrast, double gamma)
| Adjusts an image's brightness, contrast and gamma within a single operation.
BOOL | getHistogram (DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel=FICC_BLACK) const
Upsampling / downsampling
BOOL | rescale (WORD new_width, WORD new_height, FREE_IMAGE_FILTER filter)
BOOL | makeThumbnail (WORD max_size, BOOL convert=TRUE)
Image status
void | setModified (BOOL bStatus=TRUE)
| Set the image status as 'modified'.
BOOL | isModified ()
| Get the image status.
Metadata
unsigned | getMetadataCount (FREE_IMAGE_MDMODEL model) const
| Returns the number of tags contained in the model metadata model attached to the dib.
BOOL | getMetadata (FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag) const
| Retrieve a metadata attached to the dib.
BOOL | setMetadata (FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag)
| Attach a new FreeImage tag to the dib.
## Static Public Member Functions
File type identification
static FREE_IMAGE_FORMAT | identifyFIF (const char *lpszPathName)
static FREE_IMAGE_FORMAT | identifyFIFU (const wchar_t *lpszPathName)
| UNICODE version of identifyFIF (this function only works under WIN32 and does nothing on other OS).
static FREE_IMAGE_FORMAT | identifyFIFFromHandle (FreeImageIO *io, fi_handle handle)
static FREE_IMAGE_FORMAT | identifyFIFFromMemory (FIMEMORY *hmem)
## Protected Member Functions
Internal use
BOOL | replace (FIBITMAP *new_dib)
## Protected Attributes
FIBITMAP * | _dib
| DIB data.
FREE_IMAGE_FORMAT | _fif
| Original (or last saved) fif format if available, FIF_UNKNOWN otherwise.
BOOL | _bHasChanged
| TRUE whenever the display need to be refreshed.
## Friends
class | fipMultiPage

## Constructor & Destructor Documentation

fipImage::fipImage | ( | FREE_IMAGE_TYPE | image_type = `FIT_BITMAP`,
|  | WORD | width = `0`,
|  | WORD | height = `0`,
|  | WORD | bpp = `0` |
| ) |  |  |

Constructor.

See also:
  FreeImage_AllocateT

virtual fipImage::~fipImage | ( |  | ) | `[virtual]`

Destructor.

fipImage::fipImage | ( | const fipImage & | src | ) |

Copy constructor.

See also:
  FreeImage_Clone

## Member Function Documentation

BOOL fipImage::setSize | ( | FREE_IMAGE_TYPE | image_type,
|  | WORD | width,
|  | WORD | height,
|  | WORD | bpp,
|  | unsigned | red_mask = `0`,
|  | unsigned | green_mask = `0`,
|  | unsigned | blue_mask = `0` |
| ) |  |  |

Image allocator.

See also:
  FreeImage_AllocateT

virtual void fipImage::clear | ( |  | ) | `[virtual]`

Destroy image data.

Reimplemented in fipWinImage.

fipImage& fipImage::operator= | ( | const fipImage & | src | ) |

Copy constructor.

See also:
  FreeImage_Clone

Reimplemented in fipWinImage.

fipImage& fipImage::operator= | ( | FIBITMAP * | dib | ) |

Assignement operator</b>
Copy the input pointer and manage its destruction

See also:
  operator FIBITMAP*()

BOOL fipImage::copySubImage | ( | fipImage & | dst,
|  | int | left,
|  | int | top,
|  | int | right,
|  | int | bottom |
| ) |  |  | const

Copy a sub part of the current image and returns it as a fipImage object.

This method works with any bitmap type.

Parameters:

  | dst | Output subimage
  | left | Specifies the left position of the cropped rectangle.
  | top | Specifies the top position of the cropped rectangle.
  | right | Specifies the right position of the cropped rectangle.
  | bottom | Specifies the bottom position of the cropped rectangle.

Returns:
  Returns TRUE if successful, FALSE otherwise.

See also:
  FreeImage_Copy

BOOL fipImage::pasteSubImage | ( | fipImage & | src,
|  | int | left,
|  | int | top,
|  | int | alpha = `256` |
| ) |  |  |

Alpha blend or combine a sub part image with the current image.

The bit depth of dst bitmap must be greater than or equal to the bit depth of src. Upper promotion of src is done internally. Supported bit depth equals to 4, 8, 16, 24 or 32.

Parameters:

  | src | Source subimage
  | left | Specifies the left position of the sub image.
  | top | Specifies the top position of the sub image.
  | alpha | Alpha blend factor. The source and destination images are alpha blended if alpha = 0..255. If alpha > 255, then the source image is combined to the destination image.

Returns:
  Returns TRUE if successful, FALSE otherwise.

See also:
  FreeImage_Paste

BOOL fipImage::crop | ( | int | left,
|  | int | top,
|  | int | right,
|  | int | bottom |
| ) |  |  |

Crop a sub part of the current image and update it accordingly.

This method works with any bitmap type.

Parameters:

  | left | Specifies the left position of the cropped rectangle.
  | top | Specifies the top position of the cropped rectangle.
  | right | Specifies the right position of the cropped rectangle.
  | bottom | Specifies the bottom position of the cropped rectangle.

Returns:
  Returns TRUE if successful, FALSE otherwise.

static FREE_IMAGE_FORMAT fipImage::identifyFIF | ( | const char * | lpszPathName | ) | `[static]`

Identifies an image from disk, given its file name

Parameters:

  | lpszPathName | Path and file name of the image to identify.

Returns:
  Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise.

See also:
  FreeImage_GetFileType, FreeImage_GetFIFFromFilename, FreeImage documentation

static FREE_IMAGE_FORMAT fipImage::identifyFIFU | ( | const wchar_t * | lpszPathName | ) | `[static]`

UNICODE version of identifyFIF (this function only works under WIN32 and does nothing on other OS).

See also:
  FreeImage_GetFileTypeU, FreeImage_GetFIFFromFilenameU, FreeImage documentation

static FREE_IMAGE_FORMAT fipImage::identifyFIFFromHandle | ( | FreeImageIO * | io,
|  | fi_handle | handle |
| ) |  |  | `[static]`

Identifies an image using the specified FreeImageIO struct and fi_handle.

Parameters:

  | io | FreeImageIO structure
  | handle | FreeImage fi_handle

Returns:
  Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise.

See also:
  FreeImage_GetFileTypeFromHandle, FreeImage documentation

static FREE_IMAGE_FORMAT fipImage::identifyFIFFromMemory | ( | FIMEMORY * | hmem | ) | `[static]`

Identifies an image using the specified memory stream.

Parameters:

  | hmem | FreeImage memory stream

Returns:
  Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise.

See also:
  FreeImage_GetFileTypeFromMemory, FreeImage documentation

BOOL fipImage::load | ( | const char * | lpszPathName,
|  | int | flag = `0` |
| ) |  |  |

Loads an image from disk, given its file name and an optional flag.

Parameters:

  | lpszPathName | Path and file name of the image to load.
  | flag | The signification of this flag depends on the image to be read.

Returns:
  Returns TRUE if successful, FALSE otherwise.

See also:
  FreeImage_Load, FreeImage documentation

BOOL fipImage::loadU | ( | const wchar_t * | lpszPathName,
|  | int | flag = `0` |
| ) |  |  |

UNICODE version of load (this function only works under WIN32 and does nothing on other OS).

See also:
  load

BOOL fipImage::loadFromHandle | ( | FreeImageIO * | io,
|  | fi_handle | handle,
|  | int | flag = `0` |
| ) |  |  |

Loads an image using the specified FreeImageIO struct and fi_handle, and an optional flag.

Parameters:

  | io | FreeImageIO structure
  | handle | FreeImage fi_handle
  | flag | The signification of this flag depends on the image to be read.

Returns:
  Returns TRUE if successful, FALSE otherwise.

See also:
  FreeImage_LoadFromHandle, FreeImage documentation

BOOL fipImage::loadFromMemory | ( | fipMemoryIO & | memIO,
|  | int | flag = `0` |
| ) |  |  |

Loads an image using the specified memory stream and an optional flag.

Parameters:

  | memIO | FreeImage memory stream
  | flag | The signification of this flag depends on the image to be read.

Returns:
  Returns TRUE if successful, FALSE otherwise.

See also:
  FreeImage_LoadFromMemory, FreeImage documentation

BOOL fipImage::save | ( | const char * | lpszPathName,
|  | int | flag = `0` |
| ) |  |  | const

Saves an image to disk, given its file name and an optional flag.

Parameters:

  | lpszPathName | Path and file name of the image to save.
  | flag | The signification of this flag depends on the image to be saved.

Returns:
  Returns TRUE if successful, FALSE otherwise.

See also:
  FreeImage_Save, FreeImage documentation

BOOL fipImage::saveU | ( | const wchar_t * | lpszPathName,
|  | int | flag = `0` |
| ) |  |  | const

UNICODE version of save (this function only works under WIN32 and does nothing on other OS).

See also:
  save

BOOL fipImage::saveToHandle | ( | FREE_IMAGE_FORMAT | fif,
|  | FreeImageIO * | io,
|  | fi_handle | handle,
|  | int | flag = `0` |
| ) |  |  | const

Saves an image using the specified FreeImageIO struct and fi_handle, and an optional flag.

Parameters:

  | fif | Format identifier (FreeImage format)
  | io | FreeImageIO structure
  | handle | FreeImage fi_handle
  | flag | The signification of this flag depends on the image to be saved.

Returns:
  Returns TRUE if successful, FALSE otherwise.

See also:
  FreeImage_SaveToHandle, FreeImage documentation

BOOL fipImage::saveToMemory | ( | FREE_IMAGE_FORMAT | fif,
|  | fipMemoryIO & | memIO,
|  | int | flag = `0` |
| ) |  |  | const

Saves an image using the specified memory stream and an optional flag.

Parameters:

  | fif | Format identifier (FreeImage format)
  | memIO | FreeImage memory stream
  | flag | The signification of this flag depends on the image to be saved.

Returns:
  Returns TRUE if successful, FALSE otherwise.

See also:
  FreeImage_SaveToMemory, FreeImage documentation

FREE_IMAGE_TYPE fipImage::getImageType | ( |  | ) | const

Returns the data type of the image.

See also:
  FreeImage_GetImageType

WORD fipImage::getWidth | ( |  | ) | const

Returns the image width in pixels.

See also:
  FreeImage_GetWidth

WORD fipImage::getHeight | ( |  | ) | const

Returns the image height in pixels.

See also:
  FreeImage_GetHeight

WORD fipImage::getScanWidth | ( |  | ) | const

Returns the width of the bitmap in bytes rounded to the nearest DWORD.

See also:
  FreeImage_GetPitch

fipImage::operator FIBITMAP * | ( |  | ) | `[inline]`

Returns a pointer to the FIBITMAP data.

Used for direct access from FREEIMAGE functions or from your own low level C functions.
Sample use :

    	fipImage src, dst;
    	src.load("test.png");
    	dst = FreeImage_ConvertTo8Bits(src);
    	FreeImage_Save(FIF_TIFF, dst, "test.tif", 0);

See also:
  operator=(FIBITMAP *dib)

BOOL fipImage::isValid | ( |  | ) | const`[virtual]`

Returns TRUE if the image is allocated, FALSE otherwise.

Implements fipObject.

Reimplemented in fipWinImage.

BITMAPINFO* fipImage::getInfo | ( |  | ) | const

Returns a pointer to the bitmap's BITMAPINFO header.

See also:
  FreeImage_GetInfo

BITMAPINFOHEADER* fipImage::getInfoHeader | ( |  | ) | const

Returns a pointer to the bitmap's BITMAPINFOHEADER.

See also:
  FreeImage_GetInfoHeader

LONG fipImage::getImageSize | ( |  | ) | const

Returns the size of the bitmap in bytes.

The size of the bitmap is the BITMAPINFOHEADER + the size of the palette + the size of the bitmap data.

See also:
  FreeImage_GetDIBSize

WORD fipImage::getBitsPerPixel | ( |  | ) | const

Returns the bitdepth of the bitmap.

When the image type is FIT_BITMAP, valid bitdepth can be 1, 4, 8, 16, 24 or 32.

See also:
  FreeImage_GetBPP, getImageType

WORD fipImage::getLine | ( |  | ) | const

Returns the width of the bitmap in bytes.

This is not the size of the scanline.

See also:
  FreeImage_GetLine, getScanWidth

double fipImage::getHorizontalResolution | ( |  | ) | const

Returns the bitmap resolution along the X axis, in pixels / cm.

See also:
  FreeImage_GetDotsPerMeterX

double fipImage::getVerticalResolution | ( |  | ) | const

Returns the bitmap resolution along the Y axis, in pixels / cm.

See also:
  FreeImage_GetDotsPerMeterY

void fipImage::setHorizontalResolution | ( | double | value | ) |

set the bitmap resolution along the X axis, in pixels / cm

See also:
  FreeImage_GetInfoHeader

void fipImage::setVerticalResolution | ( | double | value | ) |

set the bitmap resolution along the Y axis, in pixels / cm

See also:
  FreeImage_GetInfoHeader

RGBQUAD* fipImage::getPalette | ( |  | ) | const

Returns a pointer to the bitmap's palette.

If the bitmap doesn't have a palette, getPalette returns NULL.

See also:
  FreeImage_GetPalette

WORD fipImage::getPaletteSize | ( |  | ) | const

Returns the palette size in bytes.

See also:
  FreeImage_GetColorsUsed

WORD fipImage::getColorsUsed | ( |  | ) | const

Retrieves the number of colours used in the bitmap.

If the bitmap is non-palletised, 0 is returned.

See also:
  FreeImage_GetColorsUsed

FREE_IMAGE_COLOR_TYPE fipImage::getColorType | ( |  | ) | const

Investigates the colour type of the bitmap.

See also:
  FreeImage_GetColorType, FREE_IMAGE_COLOR_TYPE

BOOL fipImage::isGrayscale | ( |  | ) | const

Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise.

See also:
  FreeImage_GetBPP, FreeImage_GetColorType

BYTE* fipImage::accessPixels | ( |  | ) | const

Returns a pointer to the bitmap bits.

It is up to you to interpret these bytes correctly, according to the results of FreeImage_GetBPP and GetRedMask, FreeImage_GetGreenMask and FreeImage_GetBlueMask.
Use this function with getScanWidth to iterates through the pixels.

See also:
  FreeImage_GetBits

BYTE* fipImage::getScanLine | ( | WORD | scanline | ) | const

Returns a pointer to the start of the given scanline in the bitmap’s data-bits. This pointer can be cast according to the result returned by getImageType.
Use this function with getScanWidth to iterates through the pixels.

See also:
  FreeImage_GetScanLine, FreeImage documentation

BOOL fipImage::getPixelIndex | ( | unsigned | x,
|  | unsigned | y,
|  | BYTE * | value |
| ) |  |  | const

Get the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access).

Parameters:

  | x | Pixel position in horizontal direction
  | y | Pixel position in vertical direction
  | value | Pixel index (returned value)

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_GetPixelIndex

BOOL fipImage::getPixelColor | ( | unsigned | x,
|  | unsigned | y,
|  | RGBQUAD * | value |
| ) |  |  | const

Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access).

Parameters:

  | x | Pixel position in horizontal direction
  | y | Pixel position in vertical direction
  | value | Pixel color (returned value)

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_GetPixelColor

BOOL fipImage::setPixelIndex | ( | unsigned | x,
|  | unsigned | y,
|  | BYTE * | value |
| ) |  |  |

Set the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access).

Parameters:

  | x | Pixel position in horizontal direction
  | y | Pixel position in vertical direction
  | value | Pixel index

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_SetPixelIndex

BOOL fipImage::setPixelColor | ( | unsigned | x,
|  | unsigned | y,
|  | RGBQUAD * | value |
| ) |  |  |

Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access).

Parameters:

  | x | Pixel position in horizontal direction
  | y | Pixel position in vertical direction
  | value | Pixel color

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_SetPixelColor

BOOL fipImage::convertToType | ( | FREE_IMAGE_TYPE | image_type,
|  | BOOL | scale_linear = `TRUE` |
| ) |  |  |

Converts an image to a type supported by FreeImage.

Parameters:

  | image_type | New image type
  | scale_linear | TRUE if image pixels must be scaled linearly when converting to a standard bitmap

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_ConvertToType, FreeImage_ConvertToStandardType

BOOL fipImage::threshold | ( | BYTE | T | ) |

Converts the bitmap to 1 bit using a threshold T.

Parameters:

  | T | Threshold value in [0..255]

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_Threshold

BOOL fipImage::dither | ( | FREE_IMAGE_DITHER | algorithm | ) |

Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm.

Parameters:

  | algorithm | Dithering algorithm to use.

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_Dither, FREE_IMAGE_DITHER

BOOL fipImage::convertTo4Bits | ( |  | ) |

Converts the bitmap to 4 bits.

Unless the bitmap is a 1-bit palettized bitmap, colour values are converted to greyscale.

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_ConvertTo4Bits

BOOL fipImage::convertTo8Bits | ( |  | ) |

Converts the bitmap to 8 bits.

If the bitmap is 24 or 32-bit RGB, the colour values are converted to greyscale.

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_ConvertTo8Bits

BOOL fipImage::convertToGrayscale | ( |  | ) |

Converts the bitmap to 8 bits.

For palletized bitmaps, the color map is converted to a greyscale ramp.

See also:
  FreeImage_ConvertToGreyscale

Returns:
  Returns TRUE if successfull, FALSE otherwise.

BOOL fipImage::colorQuantize | ( | FREE_IMAGE_QUANTIZE | algorithm | ) |

Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap.

The quantize parameter specifies which colour reduction algorithm should be used.

Parameters:

  | algorithm | Color quantization algorithm to use.

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_ColorQuantize, FREE_IMAGE_QUANTIZE

BOOL fipImage::convertTo16Bits555 | ( |  | ) |

Converts the bitmap to 16 bits.

The resulting bitmap has a layout of 5 bits red, 5 bits green, 5 bits blue and 1 unused bit.

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_ConvertTo16Bits555

BOOL fipImage::convertTo16Bits565 | ( |  | ) |

Converts the bitmap to 16 bits.

The resulting bitmap has a layout of 5 bits red, 6 bits green and 5 bits blue.

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_ConvertTo16Bits565

BOOL fipImage::convertTo24Bits | ( |  | ) |

Converts the bitmap to 24 bits.

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_ConvertTo24Bits

BOOL fipImage::convertTo32Bits | ( |  | ) |

Converts the bitmap to 32 bits.

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_ConvertTo32Bits

BOOL fipImage::convertToRGBF | ( |  | ) |

Converts the bitmap to a 96-bit RGBF image.

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_ConvertToRGBF

BOOL fipImage::toneMapping | ( | FREE_IMAGE_TMO | tmo,
|  | double | first_param = `0`,
|  | double | second_param = `0`,
|  | double | third_param = `1`,
|  | double | fourth_param = `0` |
| ) |  |  |

Converts a High Dynamic Range image (48-bit RGB or 96-bit RGB Float) to a 24-bit RGB image.

Parameters:

  | tmo | Tone mapping operator
  | first_param | First tone mapping algorithm parameter (algorithm dependant)
  | second_param | Second tone mapping algorithm parameter (algorithm dependant)
  | third_param | Third tone mapping algorithm parameter (algorithm dependant)
  | fourth_param | Fourth tone mapping algorithm parameter (algorithm dependant)

Returns:
  Returns TRUE if successfull, FALSE otherwise.

See also:
  FreeImage_ToneMapping, FreeImage_TmoReinhard05Ex

BOOL fipImage::isTransparent | ( |  | ) | const

Returns TRUE if the image is transparent, returns FALSE otherwise.

See also:
  FreeImage_IsTransparent

unsigned fipImage::getTransparencyCount | ( |  | ) | const

8-bit transparency : get the number of transparent colors.

Returns:
  Returns the number of transparent colors in a palletised bitmap.

See also:
  FreeImage_GetTransparencyCount

BYTE* fipImage::getTransparencyTable | ( |  | ) | const

8-bit transparency : get the bitmap’s transparency table.

Returns:
  Returns a pointer to the bitmap’s transparency table.

See also:
  FreeImage_GetTransparencyTable

void fipImage::setTransparencyTable | ( | BYTE * | table,
|  | int | count |
| ) |  |  |

8-bit transparency : set the bitmap’s transparency table.

See also:
  FreeImage_SetTransparencyTable

BOOL fipImage::hasFileBkColor | ( |  | ) | const

Returns TRUE when the image has a file background color, FALSE otherwise.

See also:
  FreeImage_HasBackgroundColor

BOOL fipImage::getFileBkColor | ( | RGBQUAD * | bkcolor | ) | const

Retrieves the file background color of an image.

For 8-bit images, the color index in the palette is returned in the rgbReserved member of the bkcolor parameter.

Returns:
  Returns TRUE if successful, FALSE otherwise.

See also:
  FreeImage_GetBackgroundColor

BOOL fipImage::setFileBkColor | ( | RGBQUAD * | bkcolor | ) |

Set the file background color of an image.

When saving an image to PNG, this background color is transparently saved to the PNG file. When the bkcolor parameter is NULL, the background color is removed from the image.

Returns:
  Returns TRUE if successful, FALSE otherwise.

See also:
  FreeImage_SetBackgroundColor

BOOL fipImage::getChannel | ( | fipImage & | image,
|  | FREE_IMAGE_COLOR_CHANNEL | channel |
| ) |  |  | const

Retrieves the red, green, blue or alpha channel of a 24- or 32-bit BGR[A] image.

Parameters:

  | image | Output image to be extracted
  | channel | Color channel to extract

Returns:
  Returns TRUE if successful, FALSE otherwise.

See also:
  FreeImage_GetChannel, FREE_IMAGE_COLOR_CHANNEL

BOOL fipImage::setChannel | ( | fipImage & | image,
|  | FREE_IMAGE_COLOR_CHANNEL | channel |
| ) |  |  |

Insert a 8-bit dib into a 24- or 32-bit image.

Parameters:

  | image | Input 8-bit image to insert
  | channel | Color channel to replace

Returns:
  Returns TRUE if successful, FALSE otherwise.

See also:
  FreeImage_SetChannel, FREE_IMAGE_COLOR_CHANNEL

BOOL fipImage::splitChannels | ( | fipImage & | RedChannel,
|  | fipImage & | GreenChannel,
|  | fipImage & | BlueChannel |
| ) |  |  |

Split a 24-bit RGB image into 3 greyscale images corresponding to the red, green and blue channels.

Parameters:

  | RedChannel | Output red channel.
  | GreenChannel | Output green channel.
  | BlueChannel | Output blue channel.

Returns:
  Returns FALSE if the dib isn't a valid image, if it's not a 24-bit image or if one of the output channel can't be allocated. Returns TRUE otherwise.

See also:
  FreeImage_GetChannel

BOOL fipImage::combineChannels | ( | fipImage & | red,
|  | fipImage & | green,
|  | fipImage & | blue |
| ) |  |  |

Builds a 24-bit RGB image given its red, green and blue channel.

Parameters:

  | red | Input red channel.
  | green | Input green channel.
  | blue | Input blue channel.

Returns:
  Returns FALSE if the dib can't be allocated, if the input channels are not 8-bit images. Returns TRUE otherwise.

See also:
  FreeImage_SetChannel

BOOL fipImage::rotateEx | ( | double | angle,
|  | double | x_shift,
|  | double | y_shift,
|  | double | x_origin,
|  | double | y_origin,
|  | BOOL | use_mask |
| ) |  |  |

Image translation and rotation using B-Splines.

Parameters:

  | angle | Image rotation angle, in degree
  | x_shift | Image horizontal shift
  | y_shift | Image vertical shift
  | x_origin | Origin of the x-axis
  | y_origin | Origin of the y-axis
  | use_mask | Whether or not to mask the image. Image mirroring is applied when use_mask is set to FALSE

Returns:
  Returns the translated & rotated dib if successful, returns NULL otherwise

See also:
  FreeImage_RotateEx

BOOL fipImage::rotate | ( | double | angle,
|  | const void * | bkcolor = `NULL` |
| ) |  |  |

Image rotation by means of three shears.

Parameters:

  | angle | Image rotation angle, in degree
  | bkcolor | Background color (image type dependent), default to black background

Returns:
  Returns rotated dib if successful, returns NULL otherwise

See also:
  FreeImage_Rotate

BOOL fipImage::flipHorizontal | ( |  | ) |

Flip the image horizontally along the vertical axis.

See also:
  FreeImage_FlipHorizontal

BOOL fipImage::flipVertical | ( |  | ) |

Flip the image vertically along the horizontal axis.

See also:
  FreeImage_FlipVertical

BOOL fipImage::invert | ( |  | ) |

Inverts each pixel data.

Returns:
  Returns TRUE if successful, FALSE otherwise.

See also:
  FreeImage_Invert

BOOL fipImage::adjustCurve | ( | BYTE * | LUT,
|  | FREE_IMAGE_COLOR_CHANNEL | channel |
| ) |  |  |

Perfoms an histogram transformation on a 8, 24 or 32-bit image according to the values of a lookup table (LUT).

The transformation is done as follows.
Image 8-bit : if the image has a color palette, the LUT is applied to this palette, otherwise, it is applied to the grey values.
Image 24-bit & 32-bit : if channel == IPL_CC_RGB, the same LUT is applied to each color plane (R,G, and B). Otherwise, the LUT is applied to the specified channel only.

Parameters:

  | LUT | Lookup table. The size of 'LUT' is assumed to be 256.
  | channel | The color channel to be processed (only used with 24 & 32-bit DIB).

Returns:
  Returns TRUE if the operation was successful, FALSE otherwise

See also:
  FreeImage_AdjustCurve, FREE_IMAGE_COLOR_CHANNEL

BOOL fipImage::adjustGamma | ( | double | gamma | ) |

Performs gamma correction on a 8, 24 or 32-bit image.

Parameters:

  | gamma | Gamma value to use. A value of 1.0 leaves the image alone, less than one darkens it, and greater than one lightens it.

Returns:
  Returns TRUE if the operation was successful, FALSE otherwise

See also:
  FreeImage_AdjustGamma, adjustCurve

BOOL fipImage::adjustBrightness | ( | double | percentage | ) |

Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount.

Parameters:

  | percentage | Where -100 <= percentage <= 100 A value 0 means no change, less than 0 will make the image darker and greater than 0 will make the image brighter.

Returns:
  Returns TRUE if the operation was succesful, FALSE otherwise

See also:
  FreeImage_AdjustBrightness, adjustCurve

BOOL fipImage::adjustContrast | ( | double | percentage | ) |

Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount.

Parameters:

  | percentage | Where -100 <= percentage <= 100 A value 0 means no change, less than 0 will decrease the contrast and greater than 0 will increase the contrast of the image.

Returns:
  Returns TRUE if the operation was succesfull, FALSE otherwise

See also:
  FreeImage_AdjustContrast, adjustCurve

BOOL fipImage::adjustBrightnessContrastGamma | ( | double | brightness,
|  | double | contrast,
|  | double | gamma |
| ) |  |  |

Adjusts an image's brightness, contrast and gamma within a single operation.

If more than one of these image display properties need to be adjusted, using this function should be preferred over calling each adjustment function separately. That's particularly true for huge images or if performance is an issue.

See also:
  adjustBrightness

  adjustContrast

  adjustGamma

  FreeImage_AdjustColors

BOOL fipImage::getHistogram | ( | DWORD * | histo,
|  | FREE_IMAGE_COLOR_CHANNEL | channel = `FICC_BLACK` |
| ) |  |  | const

Computes image histogram For 24-bit and 32-bit images, histogram can be computed from red, green, blue and black channels. For 8-bit images, histogram is computed from the black channel. Other bit depth is not supported.

Parameters:

  | histo | pointer to an histogram array. Size of this array is assumed to be 256.
  | channel | Color channel to use

Returns:
  Returns TRUE if the operation was succesfull, FALSE otherwise

See also:
  FreeImage_GetHistogram

BOOL fipImage::rescale | ( | WORD | new_width,
|  | WORD | new_height,
|  | FREE_IMAGE_FILTER | filter |
| ) |  |  |

Rescale the image to a new width / height.

Parameters:

  | new_width | New image width
  | new_height | New image height
  | filter | The filter parameter specifies which resampling filter should be used.

Returns:
  Returns TRUE if the operation was successful, FALSE otherwise

See also:
  FreeImage_Rescale, FREE_IMAGE_FILTER

BOOL fipImage::makeThumbnail | ( | WORD | max_size,
|  | BOOL | convert = `TRUE` |
| ) |  |  |

Creates a thumbnail image keeping aspect ratio

Parameters:

  | max_size | Maximum width or height in pixel units
  | convert | When set to TRUE, converts the image to a standard type

Returns:
  Returns TRUE if the operation was successful, FALSE otherwise

See also:
  FreeImage_MakeThumbnail

void fipImage::setModified | ( | BOOL | bStatus = `TRUE` | ) | `[inline]`

Set the image status as 'modified'.

When using the fipWinImage class, the image status is used to refresh the display. It is changed to FALSE whenever the display has just been refreshed.

Parameters:

  | bStatus | TRUE if the image should be marked as modified, FALSE otherwise

See also:
  isModified

BOOL fipImage::isModified | ( |  | ) | `[inline]`

Get the image status.

Returns:
  Returns TRUE if the image is marked as modified, FALSE otherwise

See also:
  setModified

unsigned fipImage::getMetadataCount | ( | FREE_IMAGE_MDMODEL | model | ) | const

Returns the number of tags contained in the model metadata model attached to the dib.

Parameters:

  | model | Metadata model to look for

BOOL fipImage::getMetadata | ( | FREE_IMAGE_MDMODEL | model,
|  | const char * | key,
|  | fipTag & | tag |
| ) |  |  | const

Retrieve a metadata attached to the dib.

Parameters:

  | model | Metadata model to look for
  | key | Metadata field name
  | tag | Returned tag

Returns:
  Returns TRUE if the operation was succesfull, FALSE otherwise

See also:
  FreeImage_GetMetadata

BOOL fipImage::setMetadata | ( | FREE_IMAGE_MDMODEL | model,
|  | const char * | key,
|  | fipTag & | tag |
| ) |  |  |

Attach a new FreeImage tag to the dib.

Sample use :

    	fipImage image;
    ...
    	fipTag tag;
    	tag.setKeyValue("Caption/Abstract", "my caption");
    	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
    	tag.setKeyValue("Keywords", "FreeImage;Library;Images;Compression");
    	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);

Parameters:

  | model | Metadata model used to store the tag
  | key | Tag field name
  | tag | Tag to be attached

Returns:
  Returns TRUE if the operation was succesfull, FALSE otherwise

See also:
  FreeImage_SetMetadata

## Member Data Documentation

FIBITMAP* fipImage::_dib`[protected]`

DIB data.

FREE_IMAGE_FORMAT fipImage::_fif`[protected]`

Original (or last saved) fif format if available, FIF_UNKNOWN otherwise.

BOOL fipImage::_bHasChanged`[mutable, protected]`

TRUE whenever the display need to be refreshed.

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

- FreeImagePlus.h