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);
這裏是結果截圖:
任何解決方案使尺寸相同或更小?