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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:03:01+00:00 2026-06-13T06:03:01+00:00

We are working on an native Android app that handles large images (5MP+) from

  • 0

We are working on an native Android app that handles large images (5MP+) from the phone’s gallery, eventually encoded base 64, JSONized and sent to an upstream server. We’ve used some of the guidance given in other StackOverflow questions. We’ve tried hard to keep memory usage to a minimum, following logcat closely, debugging, etc. And while we’ve gotten under control the “80% use case” we still are getting FATAL errors in certain cases (when the user picks a photo, then cancels, chooses a different one, for instance).

We’ve found that when importing a 5MP Bitmap, its size quadruples in the Heap (i.e. a 7Mb jpeg becomes 28Mb in memory). We’ve used tricks to convert to Base64 as efficiently as possible. We’ve made sure the JSON parser is not leaking and so forth.

So to get back to my original question, is there a way to circumvent Android’s Bitmap handling?

  • 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-13T06:03:02+00:00Added an answer on June 13, 2026 at 6:03 am

    eventually encoded base 64, JSONized and sent to an upstream server

    Rewrite your Web app to support binary payloads, so that you do not have to do ridiculous stuff like this. Upload JSON-encoded metadata in one request, then upload the image in its original format in a separate request, if need be. Or, use multipart upload to do both in one shot, leaving the image in its original format.

    We’ve found that when importing a 5MP Bitmap, its size quadruples in the Heap (i.e. a 7Mb jpeg becomes 28Mb in memory)

    That is because PNGs, JPEGs, and the like are compressed, and the image needs to be uncompressed to be displayed.

    is there a way to circumvent Android’s Bitmap handling?

    You do not say if you are trying to display the image or not. If you are, use BitmapFactory with an appropriate BitmapFactory.Options to scale the image.

    If you are not trying to display the image, once you rewrite the Web app to accept a binary payload, you should not need to load the entire image into memory. Just upload it in the format that it already is in, reading in chunks at a time (e.g., 8KB) to write to the OutputStrem of your HTTP PUT (or whatever) for the upload.

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

Sidebar

Related Questions

I'm working on an Android app native written in java and I'm getting a
I am working with Amazon In-app-purchases for Android on flash using native extentions. So,
I am working on an android app in which I am using some Native
I'm working on an app that involves displaying comments from a website. These comments
All, I'm working on an HTML-based web app (i.e., not native app) targeted for
I am working on an android project that requires a database. The issue that
I'm working on mobile (Android/iOS) app, which will integrate with FB and have a
I am working on a multi-platform app (Mono) that will store text in a
I am trying to use native components in a LWUIT app on Android platform.
HI Am working for the application using tabs through entire app.In that one particular

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.