OGeek|极客世界-中国程序员成长平台

标题: javascript - 如何制作目标宽度和高度大于 640 像素的高质量 PhoneGap 相机图像? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 09:57
标题: javascript - 如何制作目标宽度和高度大于 640 像素的高质量 PhoneGap 相机图像?

我使用 Cordova 3.5.0 和最新版本的 Camera plugin .我发现当我将 targetWidth 和 targetHeight 设置在 640 以上时,图像质量会下降。这是我使用的配置:

navigator.camera.getPicture(onSuccess, onFail, 
  { quality : 100,
  destinationType : Camera.DestinationType.FILE_URI,
  sourceType : Camera.PictureSourceType.CAMERA,
  allowEdit : true,
  encodingType: Camera.EncodingType.JPEG,
  targetWidth: 640,
  targetHeight: 640,
  saveToPhotoAlbum: true 
});

我用 phonegap 相机拍摄了几张照片,并比较了自动保存到相册的图像。

Here is the result (targetWidth: 640, targetHeight: 640) :

enter image description here

Here is the result (targetWidth: 800, targetHeight: 800) :

enter image description here

Here is the result (targetWidth: 1280, targetHeight: 1280) :

enter image description here

当您单击链接并比较照片时,您会发现图像越大质量越差。

如何制作目标宽度和高度大于 640 像素的高质量 PhoneGap 相机图像?



Best Answer-推荐答案


尽量不要在相机选项中设置照片的高度和宽度,并在 Canvas 元素上操作最终图像。这样,您就可以自己处理最优质的图像。

关于javascript - 如何制作目标宽度和高度大于 640 像素的高质量 PhoneGap 相机图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27043534/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4