API Reference > imodeljs-frontend > Rendering > imageBufferToCanvas imageBufferToCanvas Function Create a canvas element with the same dimensions and contents as an image buffer. imageBufferToCanvas(buffer: ImageBuffer, preserveAlpha: boolean = true): HTMLCanvasElement | undefined Parameter Type Description buffer ImageBuffer the source ImageBuffer object from which the HTMLCanvasElement object will be constructed. 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 Viewport.readImage). Returns - HTMLCanvasElement | undefined an HTMLCanvasElement object containing the contents of the source image buffer, or undefined if the conversion fails. Defined in core/frontend/src/ImageUtil.ts Line 83 Last Updated: 13 June, 2024