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

  • SEARCH
  • Home
  • 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 8647157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:59:40+00:00 2026-06-12T12:59:40+00:00

i m trying to implement some image filters fro that i use this code

  • 0

i m trying to implement some image filters fro that i use this code

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        imageView=(ImageView) findViewById(R.id.imgView);
        bgr = BitmapFactory.decodeResource(getResources(), R.drawable.test02);


        int A, R, G, B;
        int pixel;

        // scan through all pixels
        for(int x = 0; x < bgr.getWidth(); ++x) 
        {
            for(int y = 0; y < bgr.getHeight(); ++y) 
            {
                // get pixel color
                pixel = bgr.getPixel(x, y);
                A = Color.alpha(pixel);
                R = Color.red(pixel);
                G = Color.green(pixel);
                B = Color.blue(pixel);

                // increase/decrease each channel
                R += value;
                if(R > 255) { R = 255; }
                else if(R < 0) { R = 0; }

                G += value;
                if(G > 255) { G = 255; }
                else if(G < 0) { G = 0; }

                B += value;
                if(B > 255) { B = 255; }
                else if(B < 0) { B = 0; }

                // apply new pixel color to output bitmap
                bgr.setPixel(x, y, Color.argb(A, R, G, B));
            }
            System.out.println("x");
        }

        imageView.setImageBitmap(bgr);

    }

the problem is this is to slow is any other way to do it, OR make it faster..

  • 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-12T12:59:41+00:00Added an answer on June 12, 2026 at 12:59 pm

    You should read up about using a ColorMatrix. This matrix can perform exactly the operation you are performing manually. In your case, since you are just adding a constant value to each component, your matrix would have a = g = m = s = 1, and e = j = o = value, and the rest of your matrix would be zeroes.

    Then you can use setColorFilter() to apply a ColorMatrixColorFilter to your ImageView.

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

Sidebar

Related Questions

I am trying to implement some code on my web page to auto-scroll after
I'm trying to implement a JQuery script to process some areas inside an image
I'm working on a project that's trying to implement some editing features using a
I am trying to implement Camera application in android,and i got some code from
I am trying to implement image caching system in android, the caching use both,
I'm trying to implement an activity with an EditText that replaces some keywords with
I'm rewriting some code to improve tableview performance. I'm trying to implement the dequeueReusableCellWithIdentifier
I am trying to implement share this method. I am using the code as
I'm trying to implement some image processing (finding regions of similar colour) in Python
I trying to implement some relatively simple 2D sprite batching in OpenGL ES 2.0

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.