Returns the background color of the image if provided in the header.
The bit depth of the image.
Gathered from png_get_bit_depth
.
The amount of channels of the image.
Gathered from png_get_channels
.
The color type of the image as a string.
Gathered from png_get_color_type
.
The buffer containing the data of the decoded image.
The gamma value of the image.
Gathered from png_get_gAMA
.
The width of the image.
Gathered from png_get_image_height
.
The interlace type of the image as a string, gathered from png_get_interlace_type
.
The horizontal offset of the image.
Gathered from png_get_x_offset_pixels
.
The vertical offset of the image.
Gathered from png_get_y_offset_pixels
.
Retrieve the palette of this image if the color type is ColorType.PALETTE
.
The horizontal amount of pixels per meter of the image.
Gathered from png_get_x_pixels_per_meter
.
The vertical amount of pixels per meter of the image.
Gathered from png_get_y_pixels_per_meter
.
The amount of bytes per row of the image.
Gathered from png_get_rowbytes
.
Returns the last modification time as returned by png_get_tIME
.
The width of the image.
Gathered from png_get_image_width
.
Will be true
if the image's color type has an alpha channel and false
otherwise.
Returns the amount of bytes per pixel (depending on the color type) for the image.
Retrieves the color in the image's color format at the specified position.
The x position of the pixel in the image of which to retrieve the color.
The y position of the pixel in the image of which to retrieve the color.
The color at the given pixel in the image's color format.
Copies the specified rectangle from the other image (or the whole other image if rectangle is omitted) into this image at the current offset (or to the top left if the offset is omitted). Modifies this image and the underlying buffer.
The other image which should be copied into this image.
The target position in this image to which the other image should be copied.
The clipping rectangle of the other image which should be copied.
A convenience wrapper around resizeCanvas
. Crops the image to a specified sub-rectangle.
Modifies this image and the underlying buffer.
A sub-rectangle which should be cropped out of the image.
Will encode this image to a PNG buffer.
Resizes the canvas with while optionally adding padding and cropping regions from the image. Modifies this image and the underlying buffer.
Retrieves the color in rgba format, converting from the image's color format.
This will automatically convert from indexed or grayscale images to rgba. If
the image's color format doesn't provide an alpha channel, 255
is returned as alpha.
The x position of the pixel in the image of which to retrieve the color.
The y position of the pixel in the image of which to retrieve the color.
The color at the given pixel in rgba format.
Convert a set of coordinates to index in the buffer.
Convert an index in the buffer to a set of coordinates.
Will encode this image and write it to the file at the specified path.
Path to the file to which the encoded PNG should be written.
An optional callback to use instead of the Promise API.
A Promise which resolves once the file is written or undefined
if a callback was specified.
Will encode this image and write it to the file at the specified path synchroneously.
Path to the file to which the encoded PNG should be written.
Generated using TypeDoc
Decodes and wraps a PNG image. Will call the native bindings under the hood and provides a high-level access to read- and write operations on the image.