Image ¶
An object representing a image.
properties¶
Data : buffer¶
The image data as a unsigned 8 bit interleaved buffer.
Width : number¶
The width of the image in pixels.
Height : number¶
The height of the image in pixels.
Channels : number¶
How many colour channels the image has.
methods¶
Encode -> buffer ¶
Encodes the image into a certain image format.
Dimensions -> Image ¶
Sets the width and height of the image.
Returns itself.
Resize -> Image ¶
Resizes the image to a new width & height.
Interpolation filters supported:
Returns itself.
- NEAREST - nearest neighbour
- BILINEAR - bilinear interpolation between 4 points
- LANCZOS3 - LANCZOS interpolation using 36 points
Flip -> Image ¶
Vertically mirrors the image.
Returns itself.
Flop -> Image ¶
Horizontally mirrors the image.
Returns itself.
Greyscale -> Image ¶
Converts the image into greyscale using luminance.
Returns itself.
Convolve -> Image ¶
Performs a convolution on the image using the provided kernel.
Returns itself.
Clone -> Image ¶
Clones the image, returning its copy.
GradientMagnitude -> Image ¶
Computes the gradient magnitude between the image and another image.
Returns itself.
RemoveAlpha -> Image ¶
Removes the alpha channel of the image.
Treated as a no-op if the image does not have a alpha channel.
Returns itself.
metamethods¶
__tostring -> string ¶
Converts the image into a string in the format image [Width]x[Height]