Crop it here, copy the Angular code

Local image processing
CROP SELECTION
Photo to crop

Round selection changes the preview only. Exported pixels stay rectangular, just like ngx-image-cropper.

Angular code ngx-image-cropper 9.x

Template (HTML)
<label for="photo">Choose a photo</label>
<input id="photo" type="file" accept="image/*"
  (change)="fileChangeEvent($event)" />

<image-cropper
  [imageChangedEvent]="imageChangedEvent"
  [maintainAspectRatio]="true"
  [aspectRatio]="4 / 3"
  [roundCropper]="false"
  format="png"
  output="blob"
  (imageCropped)="imageCropped($event)"
  (loadImageFailed)="loadImageFailed()"
></image-cropper>

@if (croppedImage) {
  <img [src]="croppedImage" alt="Cropped photo" />
}
@if (error) { <p role="alert">{{ error }}</p> }

CROP ONLINE · BUILD WITH ANGULAR

Angular Image Cropper

Crop a photo in your browser and copy matching ngx-image-cropper code for your Angular app. Your image stays on your device.

How it works

  1. Pick an image

    Upload a local photo or start with the sample.

  2. Set ratio and round crop

    Adjust the selection, output format, and optional width.

  3. Copy the Angular code

    Copy the template and component, then install ngx-image-cropper in your app.

Built for your Angular workflow

Ngx cropper

ngx-image-cropper provides an Angular-native editor with typed inputs and crop events. Import its standalone component into your app.

Cropper component

Connect the file change event to imageChangedEvent. Handle imageCropped to receive a Blob and object URL, or a base64 data URL.

Aspect ratio

Lock a square, portrait, or landscape selection, or resize freely. Round crop changes the selection appearance, not the exported pixels.

Angular Material

Place ImageCropperComponent inside MatDialog and return the confirmed Blob with MatDialogRef.close(). Use MatSnackBar for save confirmation.

Ionic Angular

Pass a local Camera image as a Blob through imageFile. Match the Capacitor Camera plugin version to your Ionic project.

Angular module

Current NgModule apps import ImageCropperComponent too. ImageCropperModule belongs to historical releases before the standalone API.

Cropping tool comparison

OptionStandaloneRound cropAspect ratioMaintenance
ngx-image-cropperNativeRound UIBuilt inCurrent 9.x API
ngx-cropperjs-wrapperLegacy moduleCustom maskCropper.js optionsCheck compatibility
angular-cropperjsModule importCustom maskCropper.js optionsCheck compatibility
Canvas APIYour codeManual maskYour logicYou maintain it

Check package compatibility before choosing a library. For other tasks, try the home image cropper, Grid Collage, or Picture Splitter.

Angular image cropper FAQ

What is the best image cropper for Angular?

ngx-image-cropper is our default recommendation for a new Angular app. Its standalone component exposes Angular inputs and crop events directly. Check its Angular peer dependencies before installing; version 9.1.7 requires Angular 17.3 or later.

Can I use ngx-image-cropper with standalone components?

Yes. Add ImageCropperComponent to your component imports. The library became standalone in version 8, which removed ImageCropperModule. An NgModule-based app can also import the standalone component into its NgModule imports.

Does roundCropper export a circular PNG?

No. roundCropper shows a round selection, but the exported image remains square. Display it with border-radius: 50% for an avatar. For a PNG with transparent corners, use the free circle tool above or apply a circular Canvas mask yourself.

Should I store the crop as a blob or base64?

Prefer a Blob for file handling and an object URL for a temporary preview. Use output="base64" only if your integration needs a data URL. An object URL is local and temporary, not a permanent URL you can store or share.

Can this cropper work in Ionic Angular or AngularJS?

Ionic Angular can use ImageCropperComponent with a Camera image passed through imageFile or imageURL. Match the Camera plugin to your Capacitor version. AngularJS 1.x is a different framework and is end of life. ui-cropper was a legacy option; migrate to supported Angular rather than adding a new AngularJS dependency.