talira

Cropper.js

JavaScript image cropper built from web components

open sourceMITfree

Cropper.js is a JavaScript image cropper for the browser. Version 2 is a set of web components (a canvas, an image, a selection, handles, a grid, a shade, a crosshair and a viewer, each its own npm package under @cropper/), so a page can use the all-in-one Cropper class, drop the custom elements into its HTML, or import only the elements it needs. It supports several selections at once, rotating the image on touch, and previews in viewer elements; the cropped area can be drawn to a canvas and uploaded. Version 1, the all-in-one cropper that also runs in old browsers, is kept on its own branch. Install it from npm as cropperjs.

Problems it solves

  • let users crop an image in the browser before uploading it
  • crop and resize a profile picture on a web page
  • a cropper I can drop into a page as an HTML element

Features

  • image cropping web components (custom elements)
  • import only the elements you need
  • multiple selections and viewers
  • rotate the image on touch
  • customizable and extensible elements
  • crop to a canvas for upload

Limitations

  • Version 2 supports modern browsers only; version 1 is needed for old ones such as IE 9.1

Alternatives

The same job

These do what Cropper.js does.

  1. image_cropper Flutter plugin for cropping and rotating images on Android, iOS and the web

Compare Cropper.js with the top 3