Skip to content
Devix Open Source

Crop an avatar

Move the picture under the circle, then take the file — round corners and all, at exactly the size you asked for.

Live preview
<div class="demo demo--wide">
  <label class="demo-label" for="avatar">Profile picture</label>
  <input id="avatar" name="avatar" type="file">
  <div class="demo-row">
    <button class="demo-btn" id="take">Take the file</button>
    <button class="demo-btn demo-btn--ghost" id="sample">Use a sample picture</button>
  </div>
  <div class="result" id="result" hidden>
    <img id="out" alt="The cropped picture">
    <dl class="demo-kv" id="facts"></dl>
  </div>
  <p class="demo-hint">Drag the picture, pinch or scroll to zoom, or tab to the circle and use the
    arrow keys. The corners of the file really are transparent — the chequerboard shows through.</p>
</div>