new Image(image)
Class representing an Image, Graphics or a Video
Parameters:
Name | Type | Description |
---|---|---|
image |
HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas |
Classes
Members
h :Number
Image height used when image is drawn
Type:
- Number
image :HTMLImageElement|SVGImageElement|HTMLVideoElement|HTMLCanvasElement|ImageBitmap|OffscreenCanvas
Image
Type:
- HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas
w :Number
Image width used when image is drawn
Type:
- Number
Methods
(static) fromImageData(imageData) → {Promise.<Image>}
Creates Image object from ImageData object
Parameters:
Name | Type | Description |
---|---|---|
imageData |
ImageData |
Returns:
- Type
- Promise.<Image>
(static) fromUrl(url) → {Image}
Creates Image object from url
Parameters:
Name | Type | Description |
---|---|---|
url |
String |
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
|
Returns:
- Type
- void
resize(width, height) → {void}
Resizes the image for drawing
Parameters:
Name | Type | Description |
---|---|---|
width |
Number | Image width |
height |
Number | Image height |
Returns:
- Type
- void