@image-auto-crop/core
v0.0.1-alpha.4
Published
The core package of [image-auto-crop](https://github.com/wentaoliu/image-auto-crop).
Downloads
1
Readme
@image-auto-crop/core
The core package of image-auto-crop.
It is recommended to use one of the wrappers, rather than use this package directly:
- Web Component (@image-auto-crop/web)
- React (@image-auto-crop/react)
- Angular (@image-auto-crop/angular)
Install
npm i @image-auto-crop/core
Usage
This package provides a autoCropImage
function which takes the path of the image (the src
attribute of an img
element) and returns the cropped image data as a base64 string:
import { autoCropImage } from '@image-auto-crop/core';
...
const src = 'example.png';
const imageData = await autoCropImage(src);
console.log(imageData);
// data:image/png;base64,iVBOR...