FreeImage.SetBackgroundColor Method (FIBITMAP, RGBQUAD[])

FreeImage.NET

FreeImageSetBackgroundColor Method (FIBITMAP, RGBQUAD)
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.

This overloaded version of the function with an array parameter is provided to allow passing null in the bkcolor parameter. This is similar to the original C/C++ function. Passing null as bkcolor parameter will unset the dib's previously set background color.

Namespace: FreeImageAPI
Assembly: FreeImageNET (in FreeImageNET.dll) Version: 3.17.0.4 (3.17.0)
Syntax
C#
public static bool SetBackgroundColor(
	FIBITMAP dib,
	RGBQUAD[] bkcolor
)

Parameters

dib
Type: FreeImageAPIFIBITMAP
Handle to a FreeImage bitmap.
bkcolor
Type: FreeImageAPIRGBQUAD
The new background color. The first entry in the array is used.

Return Value

Type: Boolean
Returns true on success, false on failure.
Examples
// create a RGBQUAD color
RGBQUAD color = new RGBQUAD(Color.Green);

// set the dib's background color (using the other version of the function)
FreeImage.SetBackgroundColor(dib, ref color);

// remove it again (this only works due to the array parameter RGBQUAD[])
FreeImage.SetBackgroundColor(dib, null);
See Also