Skip to content

basalt / image-sharp/src / SharpImageProcessor

Class: SharpImageProcessor ​

Defined in: image-sharp/src/index.ts:83

A ImageProcessor backed by sharp. Wire it into storage: storagePlugin({ imageProcessor: new SharpImageProcessor(), ... }). sharp is a peer dependency (native libvips), loaded on first use so the app fails fast with a clear message if it isn't installed.

Implements ​

Constructors ​

Constructor ​

> new SharpImageProcessor(options?): SharpImageProcessor

Defined in: image-sharp/src/index.ts:87

Parameters ​

options? ​

SharpImageProcessorOptions = {}

Returns ​

SharpImageProcessor

Properties ​

name ​

> readonly name: "sharp" = 'sharp'

Defined in: image-sharp/src/index.ts:84

Implementation of ​

ImageProcessor.name

Methods ​

metadata() ​

> metadata(input): Promise<ImageMetadata>

Defined in: image-sharp/src/index.ts:96

Reads dimensions/format without re-encoding.

Parameters ​

input ​

Buffer

Returns ​

Promise<ImageMetadata>

Implementation of ​

ImageProcessor.metadata


run() ​

> run(input, ops): Promise<Buffer<ArrayBufferLike>>

Defined in: image-sharp/src/index.ts:91

Applies ops in order to input, returning the encoded result.

Parameters ​

input ​

Buffer

ops ​

ImageOp[]

Returns ​

Promise<Buffer<ArrayBufferLike>>

Implementation of ​

ImageProcessor.run

Released under the MIT License.