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 8747139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:18:30+00:00 2026-06-13T12:18:30+00:00

hi i m trying to implement image blur in android i fond so many

  • 0

hi i m trying to implement image blur in android i fond so many example for it but i m trying with this code

private Bitmap getBlurBitmap(Bitmap bitmap, int radius)
    {
        int w,h,total;

        if(bitmap == null){
            System.err.println(" <== BitMap is Null ==> ");
            return null;
        }

        w=bitmap.getWidth();
        h=bitmap.getHeight();

         for (int y = 0; y < h; ++y) {
             for (int x = 0; x < w; ++x) {
                 total = 0;
                 for (int ky = -radius; ky <= radius; ++ky){
                     for (int kx = -radius; kx <= radius; ++kx){
                        // total += source(x + kx, y + ky);

                         int _tempx=x + kx;
                         int _tempy=y + ky;

                         if(_tempx < 0 )
                             _tempx=0;
                         if(_tempx > w )
                            _tempx = w - kx;

                         if(_tempy < 0 )
                             _tempy=0;
                         if(_tempy > h )
                             _tempy = h - ky;

                         total += bitmap.getPixel(_tempx, _tempy);
                     }
                 }
                 bitmap.setPixel(x, y,(int)( total / (radius * 2 + 1) ^ 2));
             }
         }
        return bitmap;
    }

but whent i try to run this is display FATAL EXCEPTION like

03-18 04:41:54.296: E/AndroidRuntime(16347): FATAL EXCEPTION: main
03-18 04:41:54.296: E/AndroidRuntime(16347): java.lang.IllegalStateException
03-18 04:41:54.296: E/AndroidRuntime(16347):    at android.graphics.Bitmap.setPixel(Bitmap.java:856)
03-18 04:41:54.296: E/AndroidRuntime(16347):    at com.org.PhotoAppSimpleBlureActivity.getBlurBitmap(PhotoAppSimpleBlureActivity.java:81)
03-18 04:41:54.296: E/AndroidRuntime(16347):    at com.org.PhotoAppSimpleBlureActivity.onClick(PhotoAppSimpleBlureActivity.java:93)
03-18 04:41:54.296: E/AndroidRuntime(16347):    at android.view.View.performClick(View.java:2485)
03-18 04:41:54.296: E/AndroidRuntime(16347):    at android.view.View$PerformClick.run(View.java:9080)
03-18 04:41:54.296: E/AndroidRuntime(16347):    at android.os.Handler.handleCallback(Handler.java:587)
03-18 04:41:54.296: E/AndroidRuntime(16347):    at android.os.Handler.dispatchMessage(Handler.java:92)
03-18 04:41:54.296: E/AndroidRuntime(16347):    at android.os.Looper.loop(Looper.java:130)
03-18 04:41:54.296: E/AndroidRuntime(16347):    at android.app.ActivityThread.main(ActivityThread.java:3683)
03-18 04:41:54.296: E/AndroidRuntime(16347):    at java.lang.reflect.Method.invokeNative(Native Method)
03-18 04:41:54.296: E/AndroidRuntime(16347):    at java.lang.reflect.Method.invoke(Method.java:507)
03-18 04:41:54.296: E/AndroidRuntime(16347):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:850)
03-18 04:41:54.296: E/AndroidRuntime(16347):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
03-18 04:41:54.296: E/AndroidRuntime(16347):    at dalvik.system.NativeStart.main(Native Method)

i don’t know what wrong or what i miss,
can any one help me with this i referred this Example

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

    In docs you can see that setPixel throws IllegalStateException when Bitmap is immutable.
    You need a mutable bitmap. Simple way (one of many) to obtain one is:

    bitmap = bitmap.copy(bitmap.getConfig(), true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to implement this code , where i capture a image
I have been trying to implement a box blur algorithm in android. The code
i m trying to implement some image filters fro that i use this code
Ok well I'm trying implement something similar to the 'undo' function in many image
Trying to implement this gallery on my website. http://coffeescripter.com/code/ad-gallery/ It is noted in the
I'm trying to implement an image processing function. Here it is: typedef void (*AgFilter)(int*,
I am trying to implement image caching system in android, the caching use both,
I am trying to implement a segmentated radio button from here: https://github.com/makeramen/android-segmentedradiobutton but I
I am trying to implement share this method. I am using the code as
I am trying to implement ExpandableListView in android. But I did not find any

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.