Canvas to image.
A tool of saving or converting canvas to images(download with file extension).
Cloned from https://github.com/hongru/canvas2image.
1. Load resources.
const Canvas2Image = require('@senntyou/canvas2image');
Canvas2Image.doSomething().
2. How to use.
Canvas2Image.saveAsImage(canvas, width, height, type);
Canvas2Image.saveAsPNG(canvas, width, height);
Canvas2Image.saveAsJPEG(canvas, width, height);
Canvas2Image.saveAsGIF(canvas, width, height);
Canvas2Image.saveAsBMP(canvas, width, height);
Canvas2Image.convertToImage(canvas, width, height, type);
Canvas2Image.convertToPNG(canvas, width, height);
Canvas2Image.convertToJPEG(canvas, width, height);
Canvas2Image.convertToGIF(canvas, width, height);
Canvas2Image.convertToBMP(canvas, width, height);
saveAsImage
2.1 Save a canvas as an image.
Canvas2Image.saveAsImage(canvas, width, height, type);
-
canvas
: Canvas instance. -
width
: Image Width. -
height
: Image Height. -
type
:png|jpeg|gif|bmp
.
saveAsPNG
2.2 Save a canvas as a png image.
Canvas2Image.saveAsPNG(canvas, width, height);
-
canvas
: Canvas instance. -
width
: Image Width. -
height
: Image Height.
saveAsJPEG
2.3 Save a canvas as a jpeg image.
Canvas2Image.saveAsJPEG(canvas, width, height);
-
canvas
: Canvas instance. -
width
: Image Width. -
height
: Image Height.
saveAsGIF
2.4 Save a canvas as a gif image.
Canvas2Image.saveAsGIF(canvas, width, height);
-
canvas
: Canvas instance. -
width
: Image Width. -
height
: Image Height.
saveAsBMP
2.5 Save a canvas as a bmp image.
Canvas2Image.saveAsBMP(canvas, width, height);
-
canvas
: Canvas instance. -
width
: Image Width. -
height
: Image Height.
convertToImage
2.6 Convert a canvas to an img
element.
let img = Canvas2Image.convertToImage(canvas, width, height, type);
-
canvas
: Canvas instance. -
width
: Image Width. -
height
: Image Height. -
type
:png|jpeg|gif|bmp
.
convertToPNG
2.7 Convert a canvas to an img
element with a png image.
let img = Canvas2Image.convertToPNG(canvas, width, height);
-
canvas
: Canvas instance. -
width
: Image Width. -
height
: Image Height.
convertToJPEG
2.8 Convert a canvas to an img
element with a jpeg image.
let img = Canvas2Image.convertToJPEG(canvas, width, height);
-
canvas
: Canvas instance. -
width
: Image Width. -
height
: Image Height.
convertToGIF
2.9 Convert a canvas to an img
element with a gif image.
let img = Canvas2Image.convertToGIF(canvas, width, height);
-
canvas
: Canvas instance. -
width
: Image Width. -
height
: Image Height.
convertToBMP
2.10 Convert a canvas to an img
element with a bmp image.
let img = Canvas2Image.convertToBMP(canvas, width, height);
-
canvas
: Canvas instance. -
width
: Image Width. -
height
: Image Height.