ImageGear for C and C++ on Windows v19.6 - Updated
IG_IP_pixel_format_convert
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_pixel_format_convert

This function converts a single pixel to new color space and channel depths.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_pixel_format_convert(
        HIGPIXEL hPixel,
        enumIGColorSpaceIDs SrcColorSpace,
        const AT_INT* SrcChannelDepths,
        AT_RGBQUAD* SrcPalette,
        enumIGColorSpaceIDs DstColorSpace,
        AT_INT DstChannelCount,
        const AT_INT* DstChannelDepths,
        AT_RGBQUAD* DstPalette
);

Arguments:

Name Type Description
hPixel HIGPIXEL Pixel to convert to the new format.
SrcColorSpace enumIGColorSpaceIDs Source color space of the pixel.
SrcChannelDepths const AT_INT* Source channel depths of the pixel. Length of the array should be equal to number of channels used by the hPixel.
SrcPalette AT_RGBQUAD* Source palette used by the pixel, if its color space is Indexed, or null otherwise.
DstColorSpace enumIGColorSpaceIDs Color space to which to convert the pixel.
DstChannelCount AT_INT Number of channels for the pixel after conversion.
DstChannelDepths const AT_INT* New channel depths for the pixel. Length of the array should correspond to the dstColorSpace parameter.
DstPalette AT_RGBQUAD* Destination palette for the pixel, if destination color space is Indexed, or null otherwise.

Return Value:

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

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Remarks:

Please note that using this function in a cycle for large array of pixels could be inefficient. Consider creating a temporary HIGEAR and converting its color space and channel depths in this case.