Table of Contents

Method FlattenAlpha

Namespace
LMKit.Media.Image
Assembly
LM-Kit.NET.dll

FlattenAlpha(Color32)

Composites this image over an opaque background color and returns the result as a new RGB24 image - the step an alpha-less export (JPEG, BMP) requires before encoding. Fully transparent pixels become the background color exactly, fully opaque pixels keep their bytes, and the soft band blends linearly (source-over). Encoders do not do this on their own: encoding RGBA to JPEG keeps the raw RGB of transparent pixels, which leaks invisible content back into the file.

public ImageBuffer FlattenAlpha(Color32 background)

Parameters

background Color32

The opaque color composited behind the image.

Returns

ImageBuffer

A new RGB24 ImageBuffer at the source size. A source without an alpha channel returns a plain RGB24 conversion.

Exceptions

ObjectDisposedException

Thrown if this instance has been disposed.

Share