Skip to main content

Interface: PNGProcessor

mugshot.PNGProcessor

Implemented by#

Properties#

crop#

crop: (img: Buffer, x: number, y: number, w: number, h: number) => Promise<Buffer>

Crop a screenshot to the specified dimensions.

Will throw OutOfBoundsError if trying to crop outside of the image.

param PNG encoded buffer.

param Top left coordinate in pixels.

param Top left coordinate in pixels.

param Width in pixels.

param Height in pixels.

Type declaration:#

▸ (img: Buffer, x: number, y: number, w: number, h: number): Promise<Buffer>

Parameters:#

NameType
imgBuffer
xnumber
ynumber
wnumber
hnumber

Returns: Promise<Buffer>

Defined in: packages/mugshot/src/interfaces/png-processor.ts:13

Defined in: packages/mugshot/src/interfaces/png-processor.ts:13


paint#

paint: (img: Buffer, x: number, y: number, w: number, h: number, c: string) => Promise<Buffer>

Draw a colored rectangle over the screenshot.

param PNG encoded buffer.

param Top left coordinate in pixels.

param Top left coordinate in pixels.

param Width in pixels.

param Height in pixels.

param Hex color e.g. #ff00ff.

Type declaration:#

▸ (img: Buffer, x: number, y: number, w: number, h: number, c: string): Promise<Buffer>

Parameters:#

NameType
imgBuffer
xnumber
ynumber
wnumber
hnumber
cstring

Returns: Promise<Buffer>

Defined in: packages/mugshot/src/interfaces/png-processor.ts:31

Defined in: packages/mugshot/src/interfaces/png-processor.ts:31