Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add image effects in android ?

Tags:

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.

like image 201
aman Avatar asked Jan 28 '12 06:01

aman


People also ask

How can I add special effects to my photos?

In Photos, tap a photo to view it in full screen. Tap Edit, then tap the cropping tool at the bottom right of the screen. Swipe left under the photo to view the effects you can edit: Straighten, Vertical or Horizontal. Tap the effect you want to edit, then drag the slider to make precise adjustments.

What is ImageView in Android?

Displays image resources, for example Bitmap or Drawable resources. ImageView is also commonly used to apply tints to an image and handle image scaling.

What is Bitmap used for in Android?

A bitmap is simply a rectangle of pixels. Each pixel can be set to a given color but exactly what color depends on the type of the pixel. The first two parameters give the width and the height in pixels. The third parameter specifies the type of pixel you want to use.


2 Answers

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.

like image 186
Pete Houston Avatar answered Oct 21 '22 13:10

Pete Houston


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); 
like image 38
Gal Rom Avatar answered Oct 21 '22 13:10

Gal Rom