Michael
Michael

Reputation: 33297

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. I figured out that the image quality drops when I set the targetWidth and targetHeight above 640. Here is the configuration I use:

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):

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

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?

Upvotes: 2

Views: 4550

Answers (1)

K'shin Gendron
K'shin Gendron

Reputation: 1629

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.

Upvotes: 4

Related Questions