@loaders.gl/images module contains loader and writers for images that follow loaders.gl conventions and work under both node and browser.
npm install @loaders.gl/images npm install @loaders.gl/core
A set of functions that can extract information from "unparsed" binary memory representation of certain image formats. These functions are intended to be called on raw
ArrayBuffer data, before the
ImageLoader parses it and converts it to a parsed image type.
These functions are used internally to autodetect if image loader can be used to parse a certain
ArrayBuffer, but are also available to applications.
|`getBinaryImageMIMEType(imageData : ArrayBuffer) : String||null`|
A set of functions to work with parsed images returned by the
|Check if type is supported by current run-time environment|
|Returns the image type selected by default ( |
|Returns the type name for this image.|
|Returns an image data object with a |
The images API also offers functions to load "composite" images for WebGL textures, cube textures and image mip levels.
These functions take a
getUrl parameter that enables the app to supply the url for each "sub-image", and return a single promise enabling applications to for instance load all the faces of a cube texture, with one image for each mip level for each face in a single async operation.
|Load a single image|
|Load an array of images, e.g. for a |
|Load a map of 6 images for the faces of a cube map, or a map of 6 arrays of images for the mip levels of the 6 faces.|
As with all loaders.gl functions, while these functions are intended for use in WebGL applications, they do not call any WebGL functions, and do not actually create any WebGL textures..
To support image loading on older browsers and Node.js, the
ImageLoader can return different types, i.e. different representations of the parsed image.
ImageBitmapobject represents a bitmap image that can be performantly painted to a canvas ("without undue latency"). Due to the signficant performance advantages, and the fact that
ImageBitmapinstances can be transferred efficiently between threads,
ImageBitmapis the preferred parsed image representation in browsers, when available. Currently only available in Chrome and Firefox.
HTMLImageElement) - The traditional HTML image class. Available in all browsers.
data- Raw binary memory representing the image pixels, typically in RGBA
dataimages. and browser
ImageDataobjects can be initialized with this data.
ImageLoader for more details on options etc.