PhoneGap Camera Image 90 Degrees Flip

I see dozens of questions on stackoverflow.com where people are asking some questions around PhoneGap capturing image and its orientation like Image flips 90 Degrees  or Mirrored.

Its really not the case, Please read documentation carefully at PhoneGap.com, They have best documentation, Read it Read it Read it. You will get all Answers.

Coming back to Image Flip, You have to use “correctOrientation”  with in Camera Method property like Below.

        
	
"navigator.camera.getPicture(app.onImageSuccess, app.onImageFail, {
quality: 100,
destinationType: Camera.DestinationType.FILE_URI,
correctOrientation: true,
targetWidth: 600});    "

        

Let’s go through the properties of the options object, just so we know what’s happening:

  • quality: 100 sets the quality of the returned image.
  • destinationType: Camera.DestinationType.FILE_URI instructs the camera to return the image’s location on the device filesystem as a File URI.
  • correctOrientation: true rotates the returned image so that it shows upright regardless of the device rotation it was taken in (WebViews are not good at handling orientation EXIF data).
  • targetWidth: 600 sets the width for the returned image. Setting a target width (or height) greatly reduces the amount of memory required by the camera.
Hope this helps……..
Thanks
Advertisements

4 thoughts on “PhoneGap Camera Image 90 Degrees Flip

  1. It’s not only a matter of providing a targetWidth and set correctOrientation to fix the rotation problem. Even with your code, photos don’t get rotated, and that’s because of a memory issue rather than not reading the phonegap docs.

    Like

  2. I had been using phonegap camera plugin.
    When I try to upload an image and put it on a canvas , the orientation seems fine.
    this is the code.
    function getPhoto(source) {
    navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50, destinationType: destinationType.FILE_URI, sourceType: source });
    }
    the issue
    But when i capture a photo and then pass it to a canvas, orientation is -90 degrees
    function capturePhoto() {
    navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50, destinationType: destinationType.DATA_URL });
    }

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s