1.0.1 • Published 6 years ago

image-clip v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

Image Clip

A plugin for cropping images, using canvas to convert cropped images to base64.

Usage

  1. Install

    npm i image-clip -S

    Import into your project when the download is complete.

    import ImageClip from 'image-clip';
  2. Initialize

    Create a instance of ImageClip plugin. Container is the parent node of ImageClip.

    const imgClip = new ImageClip(container);
  3. Set source and width

    Image must be an instance of Image, width is the width of the ImageClip container.

    imgClip.setSource(image, width);
  4. Drag the bounds of image.

  5. Save the modified picture.

    Crop the picture to a specified size, and convert the result to base64.

    const path = imgClip.save(width, height);

License

MIT