aman
aman

Reputation: 193

How to add image effects in android ?

I am trying to apply effect (sepia, brightness, bloom and other image effects if API for them is available) on an image for my android app. But I am totally unable to get precise and well mannered code or concept for solving such problem. Although Android 4.0 (API 14) have build in android.media.effect api in it but I am working in Android 2.1 which have only Bitmap, Drawable, DrawableBitmap e.t.c but i am not getting which to work with.

Upvotes: 19

Views: 25943

Answers (2)

Pete Houston
Pete Houston

Reputation: 15079

I have written lots of image effects here, you can try: http://xjaphx.wordpress.com/learning/tutorials/

Note: the tutorials are meant to explain how image effect algorithms are implemented in the most simple way, it's not recommended for production usage.

Upvotes: 101

Gal Rom
Gal Rom

Reputation: 6461

As for Pete Answer I tried all of the classes he made and I'm sorry to be a party pooper but these classes are very slow it took at least 10 sec to process an Image with them. in my case I needed to process 5 images before the user can proceed with the flow.

after a few hours I came across this excellent library,(super easy to integrate with gradle):

https://github.com/wasabeef/picasso-transformations

this is an example of how to use it:

 Transformation trans1 = new ContrastFilterTransformation(getActivity(), 1.5f);
                        Transformation trans2 = new BrightnessFilterTransformation(getActivity(), 0.2f);
                        Picasso.with(getActivity()).load(uri)
                                .transform(trans1).transform(trans2).into(imageview3); 

Upvotes: 1

Related Questions