JIyrApy
JIyrApy

Reputation: 21

How can I edit a photo taken via the camera in my application?

In my application I use the camera to take photos.
I use this code to start the camera Activity:

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
timeStamp = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
File file = new File(directory, timeStamp+".png"); //name 
Uri outputFileUri1 = Uri.fromFile(file);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri1);
startActivityForResult(intent, CAMERA_RESULT);

This code is working, but how can I edit the preview image (crop, rotate,...) before my main Activity gets the data in onActivityResult()?
Or how can I start the photo editor for my image from my application?

Upvotes: 2

Views: 998

Answers (1)

Kirill Kulakov
Kirill Kulakov

Reputation: 10245

You should create a Bitmap object out of your image, then you could manipulate it.

String fooFile = "PATH TO FILE";
Bitmap bmp = BitmapFactory.decodeFile(fooFile);

here is a crop example. for more examples just Google for 'Bitmap manipulation android'

Upvotes: 1

Related Questions