I am looking for Google Photos app style image manipulation. I am kind of new to image processing. Any leads on how to make the cropping rectangle with the image the same size as cropping rectangle, rotation (which rotates both the image and cropping rectangle), image straightening (including how to get that angle slider kind of UI) will be great. If there are some libraries that has these features, that will also work.

- 588
- 4
- 8
2 Answers
Square has a library for loading and playing with images. Here are some features:
- Handling ImageView recycling and download cancelation in an adapter. - Complex image transformations with minimal memory use. - Automatic memory and disk caching.
There is detailed information on how to use the lib on their website. Check it out: Picasso
The gradle line you need to add is:
compile 'com.squareup.picasso:picasso:2.5.2'
It's very easy to use. Here is how I load and adjust an image into an ImageView in my example app:
Picasso.with(mContext).load("http://cdn0.vox-cdn.com/uploads/chorus_asset/file/798874/DSCF1913.0.jpg").fit().centerCrop().into(imageView);
As you can see, I've used fit().centerCrop()
here. This will adjust the image to fit proportionally inside my imageView
. You can try different forms of image transformations to better fit your needs.
You can also load images from your drawable folder or directly from file:
Picasso.with(context).load(R.drawable.landing_screen).into(imageView1);
Picasso.with(context).load("file:///android_asset/DvpvklR.png").into(imageView2);
Picasso.with(context).load(new File(...)).into(imageView3);
EDIT: Looks like I didn't fully understand your question when I first read it. Here are some tips for what you're trying to achieve. May not be exactly what you want, but I think it might be a start.
If you want to rotate your image, you can do it with Picasso using RequestCreator.rotate(float degrees)
.
Here's the documentation for RequestCreator.
As for cropping images (inside a specified rectangle, as you've shown), there is: Android crop.
Or you can use Picasso Transformations and create a transformation like
CropTransformation(Top, Center, Bottom);
And ask Picasso to transform the image like this:
Picasso.with(mContext).load(R.drawable.demo)
.transform(transformation).into((ImageView) findViewById(R.id.image));
Also, as @Amit K Saha said on his answer, you can use some Android SDK effects. Check android.media.effect
.
Hope this helps.

- 2,260
- 1
- 13
- 16
-
2how this is related to the question? – Amit K. Saha Jul 24 '15 at 19:04
-
@Amit K. Saha, Looks like I didn't fully understand his problem when I first read it. I've updated my answer with some tips on what he is trying to achieve. Although it might not be a final solution for what he wants, I think it might be a start. Thanks for notifying me. – Danilo Prado Jul 24 '15 at 19:49
There are some help from android sdk. May not be exactly what you are looking but worth of a shot to start. Have a look here.
And list of available effects can be found here
http://developer.android.com/reference/android/media/effect/EffectFactory.html

- 5,871
- 2
- 27
- 35