我使用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):
Here is the result (targetWidth: 800, targetHeight: 800):
Here is the result (targetWidth: 1280, targetHeight: 1280):
当您单击链接并比较照片时,您会发现质量越差,图像越大 .
How can I make PhoneGap Camera images with target width and height bigger than 640px of high quality?
1 回答
尽量不要在相机选项中设置照片的高度和宽度,并在画布元素上操作最终图像 . 这样你就可以自己处理最优质的图像 .