meo-skia-canvas
    Preparing search index...

    Function loadImage

    • Decodes an image from a path, a URL, a data: URL or a buffer.

      The source decides how it is read: an http: or https: string is fetched, where options are the fetch request options; a data: URL is decoded in place; anything else that is a string is read from disk as a path. The promise rejects if the bytes are not an image this build can decode.

      🧪 loadImage is not in the HTML Canvas standard -- a browser assigns to img.src and waits for its load event -- but Image is, and the result can be drawn with drawImage exactly as one would be there.

      Parameters

      • src: string | URL
      • Optionaloptions: RequestInit

      Returns Promise<Image>

    • Decodes an image already in memory.

      A Buffer is decoded from its own bytes. A Sharp image is converted to raw RGBA first -- with an alpha channel added if it has none -- so a pipeline can hand its output straight over without encoding to an intermediate format.

      Parameters

      • src: Buffer<ArrayBufferLike> | Sharp

      Returns Promise<Image>