Search code examples
angularcropper

ngx-image-cropper - how change only the length or width of a cropper


In my angular 9 project I use ngx-image-cropper and it is working fine. This is my cropper code:

<image-cropper
  [imageChangedEvent]="imageChangedEvent"
  [imageURL]="imageUrl"
  [transform]="transform"
  [maintainAspectRatio]="true"
  [aspectRatio]="aspectRatio"
  [canvasRotation]="canvasRotation"
  (imageCropped)="imageCropped($event)"
></image-cropper>

I can use cropper in landscape, portrait and square shapes, also scale, rotate, flip, reset cropped image. But when I change cropper width the height changes depending on the width. How can I change only the length or width of a cropper.enter image description here


Solution

  • Try to change

      [maintainAspectRatio]="false"