Contents

image

The image for the annotation.

Declaration

get image():
    | ImageDelegate
    | ImageHashObject
    | ImageSource
    | Promise<ImageSource>;
set image(
    value:
        | ImageDelegate
        | ImageHashObject
        | ImageSource
        | Promise<ImageSource>,
);

Discussion

Set this property to one of the following:

  • An ImageHashObject that contains URLs for images at multiple resolutions.

  • An ImageDelegate that dynamically provides the image.

  • An ImageSource such as an HTMLImageElement, HTMLCanvasElement, ImageBitmap, or OffscreenCanvas.

  • A Promise that resolves to an ImageSource.

Using an ImageSource or a Promise gives you control over image loading. For example, you can use the Fetch API with custom headers, apply transformations to an image before display, or implement custom error recovery logic. See ImageSource for cross-origin requirements.

See Also

Setting the image