Chevron Down
Table of Contents
Chevron DownAPI Reference

ImageLoader

An image loader that works under both Node.js (requires @loaders.gl/polyfills) and the browser.

LoaderCharacteristic
File Extension.png, .jpg, .jpeg, .gif, .webp, .bmp, .ico, .svg
File TypeBinary
File FormatImage
Data FormatImage, ImageBitmap (web worker) or ndarray (node.js)
Decoder TypeAsynchronous
Worker ThreadNo
StreamingNo

Usage

import '@loaders.gl/polyfill'; // only if using under Node
import {ImageLoader} from '@loaders.gl/images';
import {load} from '@loaders.gl/core';

const image = await load(url, ImageLoader, options);

Options

OptionTypeDefaultDescription
crossOriginString-passed to Image.crossorigin.

Remarks

  • While generic, the ImageLoader is designed with WebGL applications in mind, ensuring that loaded image data can be used to create a WebGLTexture both in the browser and in headless gl under Node.js
  • Node.js support requires import @loaders.gl/polyfills before installing this module.