API Reference > imodeljs-frontend > Rendering > canvasToImageBuffer canvasToImageBuffer Function Create an ImageBuffer in the specified format with the same dimensions and contents as a canvas. canvasToImageBuffer(canvas: HTMLCanvasElement, format: ImageBufferFormat = ImageBufferFormat.Rgba): ImageBuffer | undefined Parameter Type Description canvas HTMLCanvasElement the source HTMLCanvasElement object from which the ImageBuffer object will be constructed. format ImageBufferFormat the desired format of the created ImageBuffer; defaults to ImageBufferFormat.Rgba. Returns - ImageBuffer | undefined an ImageBuffer object containing the contents of the source canvas, or undefined if the conversion fails. Defined in core/frontend/src/ImageUtil.ts Line 116 Last Updated: 11 June, 2024