Search code examples
cordovangcordova

How can I capture an image without it being cropped to square?


I have the camera in my code, but every time after I took the picture, I can only select a portion of picture in square shape. How do I use the full image without crop into a square shape. Here is my code

 function takePhoto() {

      document.addEventListener("deviceready", function () {

        var options = {
          quality: 50,
          destinationType: Camera.DestinationType.DATA_URL,
          sourceType: Camera.PictureSourceType.CAMERA,
          allowEdit: true,
          encodingType: Camera.EncodingType.JPEG,
          targetWidth: 300,
          targetHeight: 500,
          popoverOptions: CameraPopoverOptions,
          saveToPhotoAlbum: false,
          correctOrientation: true
        };

        $cordovaCamera.getPicture(options).then(function (imageData) {
          vm.receipt = "data:image/jpeg;base64," + imageData;
        }, function (err) {
          UtilTool.showError(err);
        });

      }, false);
    }

Solution

  • Don't use the allowEdit: true,, that param is the one that takes you to the crop screen, use allowEdit: false, or remove the whole line as it's false by default