Click here to Skip to main content
13,046,726 members (43,831 online)
Click here to Skip to main content
Add your own
alternative version


3 bookmarked
Posted 22 Mar 2013

Change The Image Color in Android

, 22 Mar 2013
Rate this:
Please Sign up or sign in to vote.
This Artical shows that how we can change the color of any image throw Bitmap


In Android Programming Language Graphics provide very powerful functions by the help of which we can do many attractive work we can also design low level game for fun,So in this page we learn how we can change the color of any Image.


By using this example we can design a application that change the color of image

Using the code

Small line of code given below use to change the color of image,here only single image is use that's name is new2

                         Bitmap b=BitmapFactory.decodeResource(getResources(),R.drawable.new2);
			 can.drawBitmap(b, 10, 10,null);
			 ColorFilter f=new LightingColorFilter(0x00FF00, 0x0000FF);
			 can.drawBitmap(b, 100, 100,p);
			 ColorFilter f1=new LightingColorFilter(0x00FF00, 0xFF00FF);
			 can.drawBitmap(b, 0, 200,p);

This code should be written within onDraw() method of Graphics.

Points of Interest 

In this code on of the important thing that is interest which is ColorFilter which define which color will display.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

You may also be interested in...


Comments and Discussions

Questionhow to change color of image for multi color ? Pin
Member 115634551-Apr-15 12:14
memberMember 115634551-Apr-15 12:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 22 Mar 2013
Article Copyright 2013 by Dheeraj Singh Bhadoria
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid