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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:17:49+00:00 2026-06-06T01:17:49+00:00

I just want to see if anyone else has noticed that when loading images

  • 0

I just want to see if anyone else has noticed that when loading images into memory, the exact same C# code uses more memory to hold the images (~1.5x the amount in Java).

This Java code results in a total memory size of 105.5 MB:

Bitmap[] bitmaps = new Bitmap[100];

for (int i = 0; i < 100; i++)
{
    String root = Environment.getExternalStorageDirectory().getAbsolutePath();
    String imagePath = "/evolution/threesixty/216/Edaphosaurus_001.jpg";

    bitmaps[i] = BitmapFactory.decodeFile(root + imagePath);
}

This C# code results in 148.1 MB:

Bitmap[] bitmaps = new Bitmap[100];

for (int i = 0; i < 100; i++)
{
    string root = Environment.ExternalStorageDirectory.AbsolutePath;
    string imagePath = "/evolution/threesixty/216/Edaphosaurus_001.jpg";

    bitmaps[i] = BitmapFactory.DecodeFile(root + imagePath);
}  

Does anyone have any ideas as to why? I understand that the .NET wrappers may use a little more to hold extra binding data or things, but surely not that much?

Also, as a side question:
Each image is only 60 KB on disk, why is the in-memory version 1 MB? I know that my loading method does not do any sampling/density checking, but that was not the aim. Surely loading a <100KB image should not exceed 100KB memory space?

Here is the image I am using (994x748px @ 300dpi):

the image

  • 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-06T01:17:51+00:00Added an answer on June 6, 2026 at 1:17 am

    Based on replies from the Mono for Android mailing list:

    The images you are loading are jpg compressed. Bitmap is an
    uncompressed format. A little Googling showed a typical JPEG
    compression ratio of 10:1 to 20:1 without losing noticeable image
    quality. 60KB -> 1 MB is in that range.

    And another:

    Loading a bitmap into memory decompresses it and depending on what
    bitmap config you load it with it will take up more memory than its
    compressed size on disk.

    After looking at this information on compression (I have no idea what went on in my head as I realize that compression makes the in-memory image smaller for saving and loading it will then decompress it into memory), I now understand how things work 😉
    The image is decompressed to almost 2MB when saved as a bitmap – and if I look at the image properties in Irfanview.

    So what I am doing now is setting the sample size to 2 and using the Bitmap.Config.Rgb565. This reduces the total images size to about 30 MB, which is way better. Although the quality is not as good, I can then load the higher resolution image when I need it and the user doesn’t know.

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

Sidebar

Related Questions

I just want to see error insteas of asp.net showing me default error Server
I just want to check and see if a row exists where the $lectureName
I just want to do a quick poll to see if Fluent Nhibernate is
I just want to write code for comparing a 1D array with a 2D
Just want to round one corner instead of 4. Is it possible ?
Just want to know how I can filter out a result using mysql if
Just want to know how to read an attribute of a parent node from
Just want to ask can netbean IDE get connected to clearcase remote client server
Just want to do $_SERVER['PHP_SELF'] as a link with ?logout=1 appended to it. <a
I just want the date to show up like so: Saturday, May 26, 2012

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.