19

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.

Bala
  • 3,576
  • 10
  • 46
  • 74
aman
  • 193
  • 1
  • 1
  • 4

2 Answers2

101

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.

Pete Houston
  • 14,931
  • 6
  • 47
  • 60
  • Thanks a lot. What if I want to apply these effects before capturing the image ? User can select effect of his choice before capturing ? any help – nadeem gc Jul 25 '14 at 16:52
  • Pete Houstan have a look at my questions please http://stackoverflow.com/questions/29649137/how-to-modify-rgb-pixel-of-an-bitmap-to-look-different and http://stackoverflow.com/questions/29629833/add-filter-to-camera-output-at-runtime – Zar E Ahmer Apr 16 '15 at 10:44
1

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); 
Gal Rom
  • 6,221
  • 3
  • 41
  • 33