Croppie Image Cropper

2.6.5 · active · verified Sun Apr 19

Croppie is a lightweight, pure JavaScript image cropping library designed for easy integration into web applications. As of April 2026, the current stable version is 2.6.5. Its release cadence is irregular, with patches and minor feature updates released periodically, often addressing bug fixes and introducing new capabilities like blob/canvas output or improved accessibility. Key differentiators include its small footprint, lack of external dependencies (historically not requiring jQuery, although a breaking change related to jQuery events was noted in v2.6.0), keyboard navigation support (since v2.2.0), and flexible output options including base64, raw canvas, and file blobs. A significant consideration is the project's explicit statement regarding the absence of automated tests, which implies a higher risk of regressions or unexpected behavior in new releases, as acknowledged in the v2.5.0 release notes.

Common errors

Warnings

Install

Imports

Quickstart

Initializes Croppie on an HTML element, binds a remote image URL, configures a circular viewport, enables zoom with Ctrl key, and demonstrates retrieving the cropped image as a base64 string on button click.

<!-- HTML: Ensure croppie.css is linked -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/croppie/2.6.5/croppie.min.css">

<div id="croppie-demo" style="width: 300px; height: 300px;"></div>
<button id="get-result">Get Cropped Image</button>

<!-- JavaScript: Ensure croppie.js is loaded -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/croppie/2.6.5/croppie.min.js"></script>
<script>
  const el = document.getElementById('croppie-demo');
  const croppie = new Croppie(el, {
    viewport: { width: 150, height: 150, type: 'circle' },
    boundary: { width: 200, height: 200 },
    showZoomer: true,
    enableResize: true,
    mouseWheelZoom: 'ctrl' // Only zoom when Ctrl key is pressed
  });

  croppie.bind({
    url: 'https://images.unsplash.com/photo-1549880338-65ddcdfd017b?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTR8fGxpZ2h0aW5nfGVufDB8fDB8fHww',
    zoom: 0
  }).then(() => {
    console.log('Croppie bind complete with default image.');
  });

  document.getElementById('get-result').addEventListener('click', () => {
    croppie.result({
      type: 'base64',
      size: 'viewport',
      format: 'jpeg',
      quality: 0.8
    }).then(function (resp) {
      const img = new Image();
      img.src = resp;
      img.style.maxWidth = '100%';
      document.body.appendChild(document.createElement('br'));
      document.body.appendChild(document.createTextNode('Cropped Image:'));
      document.body.appendChild(img);
      console.log('Cropped image (base64):', resp.substring(0, 50) + '...');
    });
  });
</script>

view raw JSON →