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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:36:23+00:00 2026-05-16T02:36:23+00:00

Is there any difference when you load into bitmap the same image from bmp

  • 0

Is there any difference when you load into bitmap the same image from bmp or from png (or other format)? Does the original image format influence Bitmap object size in RAM?

Is there a way to archive Bitmap objects in order to make them less RAM resources consuming?

  • 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-05-16T02:36:24+00:00Added an answer on May 16, 2026 at 2:36 am

    There are two ways to save the data in memory

    1. Serialize and compress object with GZipStream in memory
    2. Save images to temporary directory and read them to ram if only needed.

    Image object size is not influenced with the original image format. but the size of the stream , that saves the object – does.

    Here is the way how to get stream from the object:

     public static Stream GetPNGBitmapStream(Image initial)
        {
            return GetBitmapStream(initial, "image/PNG");
        }
    
        public static Stream GetJPGBitmapStream(Image initial)
        {
            return GetBitmapStream(initial, "image/jpeg");
        }
    
        private static Stream GetBitmapStream(Image initial, string mimeType)
        {
            MemoryStream ms = new MemoryStream();
    
            var qualityEncoder = Encoder.Quality;
            var quality = (long)90;
            var ratio = new EncoderParameter(qualityEncoder, quality);
            var codecParams = new EncoderParameters(1);
            codecParams.Param[0] = ratio;
            ImageCodecInfo[] infos = ImageCodecInfo.GetImageEncoders();
    
            ImageCodecInfo jpegCodecInfo = null;
            for (int i = 0; i < infos.Length; i++)
            {
                if (string.Compare(infos[i].MimeType, mimeType,true) == 0)
                {
                    jpegCodecInfo = infos[i];
                    break;
                }
            }
    
            if (jpegCodecInfo != null)
            {
                initial.Save(ms, jpegCodecInfo, codecParams); 
                MemoryStream ms2 = new MemoryStream(ms.ToArray());
                ms.Close();
                ms.Dispose();
                return ms2;
            }
    
            return null;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if there are any difference between function __construct() { parent::__construct(); $this->load->
I want to load some images into my application from the file system. There's
Is there any difference (compiler/interpreter/juju wise, etc) between the two versions of checking the
Is there any difference between ReferencePath with condition '%(CopyLocal)'=='true' and ReferenceCopyLocalPaths ? The question
Is there any difference between: public ActionResult logOff() { FormsAuth.SignOut(); return RedirectToAction(index, Home); }
Is there any difference between '{' and '[' when formatting a JSON object?
Is there any difference between the below 2 CREATE TABLE statements in SQL Server
Is there any difference between doing this: $(.topHorzNavLink).click(function() { var theHoverContainer = $(#hoverContainer); var
Is there any difference between the following two examples and should one be preferred
Is there any difference between starting a program file with any of those? #!/usr/bin/env

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.