imageBufferToBase64EncodedPng Function
Converts the contents of an ImageBuffer to PNG format.
imageBufferToBase64EncodedPng(buffer: ImageBuffer, preserveAlpha: booleantrue): string | undefined
@returns a base64-encoded string representing the image as a PNG, or undefined if the conversion failed.
Parameter | Type | Description |
---|---|---|
buffer | ImageBuffer | The ImageBuffer, of any format. |
preserveAlpha | boolean | If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from readImageBuffer). |
Returns - string | undefined
a base64-encoded string representing the image as a PNG, or undefined if the conversion failed.
Defined in
Last Updated: 14 November, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.