1.0.1 • Published 3 years ago

gif-cropper v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

GIF Cropper

Crop GIF images using Javascript.

Features

  • Support for GIF cropping.
  • Support for collaboration with cropperjs.
  • Support for PNG / JPG /JPEG cropping.

Demo

Online Demo

Preview

GIF

Static Image

Getting started

Installation

npm i gif-cropper

Usage

import { GIFCropper } from 'gif-cropper';

const imageCropper = new GIFCropper({
  src: gifUrl,
  cropperJsOpts: {
    width: 400,
    height: 240,
    rotate: 45,
    y: 0,
    x: 0,
  }
});

imageCropper.crop().then(blobUrl => {
  const img = document.createElement('img');
  img.src = blobUrl;
  document.body.appendChild(img);
});

Working With CropperJs

import { GIFCropper, CustomCropper } from 'gif-cropper';

const imageCropper = new GIFCropper({
  cropperInstance: cropperInstance as CustomCropper,
  src: gifUrl
});

imageCropper.crop().then(blobUrl => {
  const img = document.createElement('img');
  img.src = blobUrl;
  document.body.appendChild(img);
});