简体   繁体   English

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

[英]How can I make PhoneGap Camera images with target width and height bigger than 640px of high quality?

I use Cordova 3.5.0 and the latests version of the Camera plugin . 我使用Cordova 3.5.0和Camera插件的最新版本。 I figured out that the image quality drops when I set the targetWidth and targetHeight above 640. Here is the configuration I use: 我发现将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 
});

I did several tests capturing photos with the phonegap camera and compared the images that were automatically saved to album. 我进行了一些测试,使用电话间隙式摄像头捕获照片,并比较了自动保存到相册的图像。

Here is the result (targetWidth: 640, targetHeight: 640) : 结果如下(targetWidth:640,targetHeight:640)

在此处输入图片说明

Here is the result (targetWidth: 800, targetHeight: 800) : 结果如下(targetWidth:800,targetHeight:800)

在此处输入图片说明

Here is the result (targetWidth: 1280, targetHeight: 1280) : 结果是(targetWidth:1280,targetHeight:1280)

在此处输入图片说明

When you click on the links and compare the photos you see that the quality gets worse the bigger the image is. 当您单击链接并比较照片时,图像越大质量越差。

How can I make PhoneGap Camera images with target width and height bigger than 640px of high quality? 如何使目标宽度和高度大于640像素的高质量PhoneGap摄像机图像?

Try not setting the photo height and width in the camera options and manipulate the final image on a canvas element. 尝试不要在相机选项中设置照片的高度和宽度,并在画布元素上处理最终图像。 That way you're working with the best quality image yourself. 这样一来,您就可以自己处理最优质的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM