image-ghost-canvas
v1.1.0
Published
image resize, canvas resize
Downloads
4
Maintainers
Readme
image-ghost-canvas
image-ghost-canvas is a tool for image you want to trimming cut on Browser. for example if you want to cut with keeping the image's aspect ratio, I recommend this tool for that.
Demo
Plunker
Usage
import ImageGhostCanvas from 'image-ghost-canvas';
public imageGhostCanvas = new ImageGhostCanvas(option);
option
<Object>
- size <Number> Size for trimming image size.
Resize image
imageGhostCanvas.resizeImage(data);
data
<data URI> you can git encoded image data that its type jpeg or ping.
Return:
<Promise>
Example
// success
imageGhostCanvas.resizeImage(imageData)
.then((data) => {
imageSrc = data;
});
// error
imageGhostCanvas.resizeImage(imageData)
.catch((error) => {
// when it result error, do something for error.
});