Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9115529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:27:17+00:00 2026-06-17T04:27:17+00:00

I am trying to change image color dynamically in android .but it takes to

  • 0

I am trying to change image color dynamically in android .but it takes to much time .

Below function is used for changing color.

  public void greenColor(ImageView imageView,String fileName){
                System.out.println("in green color method");

             //initialize the Bitmap Object  

              Bitmap  bmp = BitmapFactory.decodeFile(fileName);
               //  Bitmap bmp = ((BitmapDrawable)imageView.getDrawable()).getBitmap();  
                //Guarantees that the image is decoded in the ARGB8888 format  
                bmp = bmp.copy(Bitmap.Config.ARGB_8888, true);  



                //Initialize the intArray with the same size as the number of pixels on the image  
                int[] intArray  = new int[bmp.getWidth()*bmp.getHeight()];  

                //copy pixel data from the Bitmap into the 'intArray' array  
                bmp.getPixels(intArray, 0, bmp.getWidth(), 0, 0, bmp.getWidth(), bmp.getHeight());  



                //replace the red pixels with yellow ones  
                try{
                    for (int i=0; i < intArray.length; i++)  
                    {  
                        //System.out.println("pixel value :"+intArray[i]);
                        //intArray[i] =  0xFFFF0000;  

                        if(intArray[i] == Color.WHITE)  
                        {  

                           System.out.println("color white ");
                        } else{
                            System.out.println(intArray[i]);
                            intArray[i]=Color.GREEN;
                        }
                    }  
                }catch(Exception e){
                    System.out.println("pixel error "+e);
                }


                //Initialize the bitmap, with the replaced color  
                bmp = Bitmap.createBitmap(intArray, bmp.getWidth(), bmp.getHeight(), Bitmap.Config.ARGB_8888);  

                //Draw the bitmap with the replaced color  
                imageView.setImageBitmap(bmp);  
               //----end color

        }

I’ve tried so much and did google search, but i am unable to solve my problem ,

Is there any technique to reduce image color change time in android?

Please help me …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:27:18+00:00Added an answer on June 17, 2026 at 4:27 am

    in your case its taking time as you are converting the image into 2d array and checking at every index.

    So if image if 2000*2000 size, just imagine how much you are processing.
    If you want to change the alfa or tint then you should use the Bitmap APIs instead of doing it manually.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see the attached image. I'm trying to change the color on the segmented
I am trying to change desktop image using below code: NSError *anError = nil;
I'm trying to change the background color of fancybox2 from black to blue, but
I m trying to change color space for image objects of a pdf file,
I am trying to change the color of a transparent image inside a div
I'm trying to change color of an image in a background thread. Apple doc
I'm trying to change UIPageViewController shadow color while doing a flip animation. But always
I am trying to change the background color and make an image appear on
I'm trying to change the color on a white marker image by code. I
I'm trying to dynamically generate a gif image of a specified size and color

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.