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)

Syntax

C#
public static bool SetBackgroundColor(
	FIBITMAP dib,
	RGBQUAD[] bkcolor
)
Visual Basic (Declaration)
Public Shared Function SetBackgroundColor ( _
	dib As FIBITMAP, _
	bkcolor As RGBQUAD() _
) As Boolean
Visual C++
public:
static bool SetBackgroundColor(
	FIBITMAP dib, 
	array<RGBQUAD>^ bkcolor
)

Parameters

dib
Type: FreeImageAPI..::.FIBITMAP
Handle to a FreeImage bitmap.
bkcolor
Type: array< FreeImageAPI..::.RGBQUAD >[]()[]
The new background color. The first entry in the array is used.

Return Value

Returns true on success, false on failure.

Examples

CopyC#
// 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);

Version Information

FreeImage.NET

Supported in: 3.11.0, 3.12.0, 3.13.0, 3.13.1

See Also