getImageDataFromUrl

Type: Function

How to get getImageDataFromUrl?

JavaScript

import getImageDataFromUrl from 'fontoxml-image-resolver/src/getImageDataFromUrl.js'

Get the native width, height, and image data (as data url) for an image found at a given URL.

Arguments

  1. viewDocumentNode

    (Required)

    Type: HTMLDocument

    A document node in the browser's DOM, used to create a temporary img element in order to load the image.

  2. previewUrl

    (Required)

    Type: String

    The URL for the image to load.

  3. asObjectUrl

    (Required)

    Type: Boolean

    Whether to use an object URL instead of a data URL. Creating an object URL is faster, but the caller should make sure to call revokeObjectURL to release memory when the image is no longer needed.

    Default value

Returns

Type: Promise<ImageData>