System.Byte[] ToWebP( int quality )

book_4_sparkGenerated
code_blocksInput

Description

The ToWebP method converts the current Bitmap instance into a WebP image format and returns the image data as a byte array. The quality of the resulting WebP image can be specified using the quality parameter.

Usage

To use the ToWebP method, you need to have an instance of the Bitmap class. Call the method on this instance, passing an integer value for the quality parameter, which should be between 0 and 100, where 100 represents the highest quality.

Example

// Create a Bitmap instance
Bitmap bitmap = new Bitmap();

// Convert the bitmap to WebP format with a quality of 80
byte[] webpData = bitmap.ToWebP(80);

// The webpData now contains the WebP image data