load an image as a Blob, with the chosen optional type encoding (default is "image/png").
possible image sources are:

  • data uri for base64 encoded image string
  • http uri path string
  • file uri path string
  • buffer of RGBA pixel byte data as Uint8Array, Uint8ClampedArray, ArrayBuffer, or Array<number>
  • ImageBitmapSource, which includes:
    • Blob
    • ImageData
    • HTMLCanvasElement or OffscreenCanvas
    • HTMLImageElement or SVGImageElement or HTMLVideoElement
    • ImageBitmap
  • Parameters

    • img_src: AnyImageSource

      anything image representation that can be constructed into an ImageBitmap using constructImageBitmapSource

    • Optionalwidth: number

      when using Uint8Array, Uint8ClampedArray, ArrayBuffer, or Array<number> as img_src, you must necessarily provide the width of the image

    • Optionalcrop_rect: Rect

      specify a cropping rectangle

    • Optionalbitmap_options: ImageBitmapOptions

      these are ImageBitmapOptions that can be used for optionally cropping the img_src, changing its colorSpace, etc...

    • Optionalblob_options: ImageEncodeOptions

      specify type: ImageMIMEType and quality: number to encode your output Blob into note that when using Uint8Array, Uint8ClampedArray, ArrayBuffer, or Array<number>, your should provide a width as the second argument to this function
      you can also provide an optional image element as the third argument to load the given img_src onto, otherwise a new one will be made

    Returns Promise<ImageBlob>