ImageGear Professional DLL v17.1 for Windows Accusoft
IG_palette_save
Send Feedback  
ImageGear Professional DLL v17.1 for Windows > API Reference Guide > Core Component API Reference > Core Component Functions Reference > Palette Functions > IG_palette_save

Glossary Item Box

This function saves a palette to a file.

Declaration:

  Copy Code
AT_ERRCOUNT ACCUAPI IG_palette_save (
        const LPSTR lpszFileName, 
        LPAT_RGBQUAD lpPalette, 
        UINT nNumEntries, 
        AT_MODE nFileType 
);

Arguments:

lpszFileName Name of file to which to save palette.
lpPalette Far pointer to array of AT_RGBQUAD structs constituting palette to save.
nNumEntries Number of entries in palette.
nFileType IG_PALETTE_FORMAT_ constant specifying format in which to save palette. The constants are listed in accucnst.h.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

This function does not process image pixels.

Sample:

Palette Edit

Example:

  Copy Code
HIGEAR hIGear;      /* Handle of image whose palette to save  */
LPAT_RGBQUAD lpPalettePntr; /* Will hold address of the DIB palette  */
UINT nEntries;    /* Will hold number of entries in palette  */
/* Obtain address of DIB palette and its number of entries );
IG_image_DIB_palette_pntr_get ( hIGear, &lpPalettePntr, &nEntries );
/* Save to a file, saving only 3 bytes per entry, in order B-G-R: */
nErrcount = IG_palette_save ( "Savedpal.pal", lpPalettePntr, nEntries,
IG_PALETTE_FORMAT_RAW_BGR );

Remarks:

Argument nFileType lets you select the format in which to save the palette. If you save the palette using IG_PALETTE_FORMAT_TEXT, its format will be as shown for the following palette of a 1-bit black-and-white image:

  Copy Code
AccuSoft Palette File ver 7.0.9
0 0 0 0
1 255 255 255

The first line identifies the version of ImageGear that created this Palette text file. Then each succeeding line gives the entry number, followed by the Red, Green, and Blue color intensities, respectively, for that palette color.

©2012. Accusoft Corporation. All Rights Reserved.