我正在使用ng2-img-cropper进行图像裁剪,但是如果图像为矩形,则无法捕获整个图像,因此无法按矩形尺寸进行裁剪。
答案 0 :(得分: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;