Class: Image

Image(image)

new Image(image)

Class representing an Image, Graphics or a Video
Parameters:
Name Type Description
image HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas
Source:

Classes

Image

Members

h :Number

Image height used when image is drawn
Type:
  • Number
Source:

image :HTMLImageElement|SVGImageElement|HTMLVideoElement|HTMLCanvasElement|ImageBitmap|OffscreenCanvas

Image
Type:
  • HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas
Source:

w :Number

Image width used when image is drawn
Type:
  • Number
Source:

Methods

(static) fromImageData(imageData) → {Promise.<Image>}

Creates Image object from ImageData object
Parameters:
Name Type Description
imageData ImageData
Source:
Returns:
Type
Promise.<Image>

(static) fromUrl(url) → {Image}

Creates Image object from url
Parameters:
Name Type Description
url String
Source:
Returns:
Type
Image

crop(rectangle) → {void}

Crops the original image to a rectangle
Parameters:
Name Type Description
rectangle Object Object represnting the rectangle to crop out of the original image
Properties
Name Type Attributes Description
x Number <optional>
The x coordinate of the upper left corner of the rectangle
y Number <optional>
The y coordinate of the upper left corner of the rectangle
width Number <optional>
The width of the rectangle
height Number <optional>
The height of the rectangle
Source:
Returns:
Type
void

resize(width, height) → {void}

Resizes the image for drawing
Parameters:
Name Type Description
width Number Image width
height Number Image height
Source:
Returns:
Type
void