Tip
See the Remarks section of the ConvertPixelFormat(Image, PixelFormat, Color, Byte) method for more details and image examples.
public static Task<Bitmap?> ConvertPixelFormatAsync(
this Image image,
PixelFormat newPixelFormat,
Color backColor = default,
byte alphaThreshold = 128,
TaskConfig? asyncConfig = null
)
<ExtensionAttribute>
Public Shared Function ConvertPixelFormatAsync (
image As Image,
newPixelFormat As PixelFormat,
Optional backColor As Color = Nothing,
Optional alphaThreshold As Byte = 128,
Optional asyncConfig As TaskConfig = Nothing
) As Task(Of Bitmap)
public:
[ExtensionAttribute]
static Task<Bitmap^>^ ConvertPixelFormatAsync(
Image^ image,
PixelFormat newPixelFormat,
Color backColor = Color(),
unsigned char alphaThreshold = 128,
TaskConfig^ asyncConfig = nullptr
)
[<ExtensionAttribute>]
static member ConvertPixelFormatAsync :
image : Image *
newPixelFormat : PixelFormat *
?backColor : Color *
?alphaThreshold : byte *
?asyncConfig : TaskConfig
(* Defaults:
let _backColor = defaultArg backColor new Color()
let _alphaThreshold = defaultArg alphaThreshold 128
let _asyncConfig = defaultArg asyncConfig null
*)
-> Task<Bitmap>
Alternatively, you can also use the BeginConvertPixelFormat(Image, PixelFormat, Color, Byte, AsyncConfig) method, which is available on every platform.
This method is not a blocking call even if the MaxDegreeOfParallelism property of the asyncConfig parameter is 1.