When wanting to take a photo, crop and save the image in an Android application, I use the following intent in my Java...
Intent camera=new Intent();
camera.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
camera.putExtra("crop", "true");
camera.putExtra("outputX",600);
camera.putExtra("outputY", 600);
camera.putExtra("aspectX", 1);
camera.putExtra("aspectY", 1);
camera.putExtra("scale", true);
camera.putExtra("return-data", false);
The above intent works great, however my Y and X are always equal. I am looking to break down the code to find out what specifies this so that I can make customisable - and most importantly independent - X and Y values for the image which I have taken and wish to crop...
NOTE : THE USE OF camera.putExtra("crop", "true");
IS NOT ADVISED... See Comments above for details... The aspect parts did however fix my issues !
Intent camera=new Intent();
/** This specifies the action for this intent when it is called. */
camera.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
/** This says yes we can crop the image. */
camera.putExtra("crop", "true");
/** These provide the initial dimensions for X and Y. */
camera.putExtra("outputX",600);
camera.putExtra("outputY", 600);
/** These provide the relative aspects. */
camera.putExtra("aspectX", 1);
camera.putExtra("aspectY", 1);
/** These I am unsure about. */
camera.putExtra("scale", true);
camera.putExtra("return-data", false);
so by setting the aspects to 0 instead of 1,
/** These provide the relative aspects. */
camera.putExtra("aspectX", 0);
camera.putExtra("aspectY", 0);
They become independent of each other...
Problem solved !
FINAL CODE
Intent camera=new Intent();
camera.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
camera.putExtra("crop", "true");
camera.putExtra("outputX",600);
camera.putExtra("outputY", 600);
camera.putExtra("aspectX", 0);
camera.putExtra("aspectY", 0);
camera.putExtra("scale", true);
camera.putExtra("return-data", false);