小编Beh*_*nam的帖子

如何在不降低质量和目标宽度和高度的情况下调整 Ionic 3 中的图像大小?

我想减小相机 API 拍摄的图像的大小,但质量降低并不好。最好的办法是降低分辨率,但我不想为所有图像使用目标宽度和高度。

例如,我希望图像宽度为 1280 并且图像高度按比例自动更改,但在 API 中我应该使用精确的宽度和高度。

如何通过图像比例更改高度动态???

现在,我使用以下代码:

 this.camera.getPicture({
  quality: 60,
  destinationType: this.camera.DestinationType.FILE_URI,
  sourceType: sourceType,
  mediaType: this.camera.MediaType.PICTURE,
  targetWidth: 1280,
  targetHeight: 1280,
  encodingType: this.camera.EncodingType.JPEG,
  saveToPhotoAlbum: (source === PictureSource.CAMERA),
  allowEdit: true
})
Run Code Online (Sandbox Code Playgroud)

camera resize ionic-framework ionic3

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

camera ×1

ionic-framework ×1

ionic3 ×1

resize ×1