Canvacord

ImageFilterer

Creates a new CanvasHelper instance.

new ImageFilterer(width, height)
ParameterTypeDescriptionOptional
width

The width of the canvas

height

The height of the canvas

Properties

height

The height of the canvas

Type:number

steps

The steps to apply to the canvas.

width

The width of the canvas

Type:number

Methods

blur(value);

Applies blur filter to the image.

ParameterTypeDescriptionOptional
value

The filter intensity

brightness(value);

Applies brightness filter to the image.

ParameterTypeDescriptionOptional
value

The filter intensity

contrast(value);

Applies contrast filter to the image.

ParameterTypeDescriptionOptional
value

The filter intensity

drawImage(image, x, y, [width], [height]);

Draws the image to the canvas.

ParameterTypeDescriptionOptional
image

The image to draw

x

The x position to draw the image

y

The y position to draw the image

width

The width of the image

height

The height of the image

dropShadow(config);

Applies drop-shadow filter to the image.

ParameterTypeDescriptionOptional
config

The drop-shadow config

encode();

Encodes the canvas to a buffer.

Returns:Promise<Buffer>

getFinalCanvas();

Returns the canvas instance by applying the steps.

Returns:Promise<Canvas>

grayscale(value);

Applies grayscale filter to the image.

ParameterTypeDescriptionOptional
value

The filter intensity

hueRotate(value);

Applies hue-rotate filter to the image.

ParameterTypeDescriptionOptional
value

The degrees to rotate

invert(value);

Applies invert filter to the image.

ParameterTypeDescriptionOptional
value

The filter intensity

opacity(value);

Applies opacity filter to the image.

ParameterTypeDescriptionOptional
value

The filter intensity

process(canvas, ctx);

Renders the applied filters to the canvas.

ParameterTypeDescriptionOptional
canvas
Canvas

The canvas to render the filters to

ctx
SKRSContext2D

The canvas context

Returns:Promise<void>

saturate(value);

Applies saturate filter to the image.

ParameterTypeDescriptionOptional
value

The filter intensity

sepia(value);

Applies sepia filter to the image.

ParameterTypeDescriptionOptional
value

The filter intensity