Skip to main content

Function: loadImageToCanvas()

loadImageToCanvas(options): Promise<CanvasLoadPosition>

Loads and renders an imageId to a Canvas. It will use the GPU rendering pipeline for image by default but you can force the CPU rendering pipeline by setting the useCPURendering parameter to true.

Parameters

options

options.canvas: HTMLCanvasElement

options.imageAspect?: boolean

options.imageId: string

options.physicalPixels?: boolean

options.priority?: number

options.renderingEngineId?: string

options.requestType?: RequestType

options.thumbnail?: boolean

options.useCPURendering?: boolean

options.viewportOptions?: ViewportInputOptions

options.viewPresentation?: ViewPresentation

options.viewReference?: ViewReference

Returns

Promise<CanvasLoadPosition>

  • A promise that resolves when the image has been rendered with the imageId

Example

const canvas = document.getElementById('myCanvas')
const imageId = 'myImageId'

loadImageToCanvas(canvas, imageId)

Defined in

packages/core/src/utilities/loadImageToCanvas.ts:100