1

我正在使用 ng2-img-cropper 进行图像裁剪,但如果图像是矩形,那么它不会捕获整个图像,我无法按矩形大小进行裁剪。

4

1 回答 1

1

请尝试此代码:-

   //canvas
    this.cropperSettings.canvasWidth = 400;
    this.cropperSettings.canvasHeight = 300;

    //crop size
    this.cropperSettings.croppedWidth = 300;
    this.cropperSettings.croppedHeight = 150;

    //aspect ratio
    this.cropperSettings.width = 150;
    this.cropperSettings.height = 150;

    // keep the original image size (minus cropping)
    this.cropperSettings.preserveSize = true;

    this.cropperSettings.keepAspect = false;
于 2018-08-02T05:17:30.873 回答