1
我使用此插件angular-image-cropper裁剪我的图像和ng-file-upload上传我的图像。角度裁剪的图像文件尺寸变大
问题是说我的图像尺寸是1955px * 1300px大小约194kb。
我剪裁到800px * 450px后,尺寸变成550kb左右。
这是正确的吗?因为它几乎成为4倍大,从它的原始尺寸
我的html代码:
<div class="form-group">
<label class="control-label">Cover</label>
<input type="file" ngf-select="uploadFiles($files,$invalidFiles)" name="cover" id="cover" ngf-pattern="image/*" accept="image/*"
ng-model="upload.coverSource" ngf-max-size="512KB" ngf-min-width="800" img-cropper-fileread image="upload.coverSource"
disable-invalid-styling="true" disable-valid-styling="true">
<canvas ng-show="upload.coverSource" width="500" height="281" id="canvas" image-cropper image="upload.coverSource"
cropped-image="category.coverCrop" crop-width="800" crop-height="450" keep-aspect="true" crop-area-bounds="bounds">
</canvas>
</div>
在我的角度我只是试图CONSOLE.LOG他们两个:
console.log($scope.upload.coverSource);
// and i need to convert it to blob first to get the data.
// category.coverCrop value is in data:base64
var cover = Upload.dataUrltoBlob(category.coverCrop);
console.log(cover);
这里是结果截图:
任何解决方案使尺寸相同或更小?