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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:06:37+00:00 2026-06-16T11:06:37+00:00

I try to make simple image filter in android renderscript, and it does work

  • 0

I try to make simple image filter in android renderscript, and it does work for small images. However I get out of memory error for a picture as big as picture taken with camera for example (everything works fine for small images though). I know my code is kinda lousy (mostly copied from here ), so any tip on how to make renderscript computation on big bitmap is appreciated.. Here’s the code for calling rs:

RenderScript rs = RenderScript.create(this);
        Allocation allocIn = Allocation.createFromBitmap(rs, bmp);
        Allocation allocOut = Allocation.createTyped(rs,  allocIn.getType());

        ScriptC_sample sc = new ScriptC_sample(rs, getResources(), R.raw.sample);

        sc.set_in(allocIn);
        sc.set_out(allocOut);

        sc.forEach_root(allocIn, allocOut);

        Bitmap bmpOut = Bitmap.createBitmap(bmp.getWidth(), bmp.getHeight(), bmp.getConfig());
        allocOut.copyTo(bmpOut);
        imgView.setImageBitmap(bmpOut);     

And here’s what i believe is relevant from rendescript file itself:

rs_allocation in;

void root(const uchar4* v_in, uchar4* v_out, const void* usrData, 
uint32_t x, uint32_t y) {

    float4 curPixel = rsUnpackColor8888(*v_in);

    // ... computations 

    *v_out = rsPackColorTo8888(curPixel.r, curPixel.g, curPixel.b, curPixel.a);
} 

I do understand that I can’t really load such a big bitmap to memory (I can load the file into imageView though?), and I’ve previously used inJustDecodeBounds to handle it.. But here I have no idea how and where to use it, and I don’t want to resize the bitmap (I’d like to process the original file and save modified file of the same size)

  • 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-16T11:06:38+00:00Added an answer on June 16, 2026 at 11:06 am

    If you are running on devices with Android 2.3.3 or later then you can use BitmapRegionDecoder to read in only part of an image file. Therefore you can read in a region, process it and save the results, then repeat until the entire image has been processed.

    Depending on what image processing you are doing, you may need to overlap the regions to correctly process their edges.

    In the Android framework I do not believe there is an equivalent of BitmapRegionDecoder for saving out large images in sections so you will have to use an external library to achieve that. Something like PNGJ allows line by line load and save of PNG files (I have not used PNGJ so cannot comment on the library itself).

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

Sidebar

Related Questions

I'm pretty new to PHP, but I decided to try and make a simple
I'll try to make this as simple as possible. I'm working on a site
Alright, I'll try and make this as simple as possible. I'm trying to create
I wanted to make some simple file recovery software, where I want to try
Ok, so I'll try to make that question a little more simple. The core
New to batch files, first try actually. Trying to make a simple batch file
When I try to make a simple module in IntelliJ it responds with: Fatal
I will try to make this simple and quick.. I have never attempted this
I'll try to make this as simple a posible. I just started working with
i try to make a while{ part in php, to read out a mysql

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.