Chevron Down
Table of Contents
Chevron DownAPI Reference

ImageWriter

The ImageWriter class can encode an image into ArrayBuffer both under browser and Node.js

LoaderCharacteristic
File Extension.png, .jpg, .jpeg
File FormatBinary
Data FormatArrayBuffer
File FormatImage
Encoder TypeAsynchronous
Worker ThreadNo
StreamingNo

Usage

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

const image = await encode(arrayBuffer, ImageWriter, options);

Options

OptionTypeDefaultDescription
typeString'png'image type *

* Supported image types (MIME types) depends on the environment. Typically PNG and JPG are supported.