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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:49:33+00:00 2026-05-23T12:49:33+00:00

I am trying to save an image from string. so I want to know

  • 0

I am trying to save an image from string.

so I want to know how I can set image height and width in inches at the time of saving the image.

my code follows for image saving :

 private void Base64ToImage(string base64String)
    {
        Image fullSizeImg = null;
        byte[] imageBytes = Convert.FromBase64String(base64String);
        MemoryStream ms = new MemoryStream(imageBytes);
        fullSizeImg = Image.FromStream(ms, true);
        System.Drawing.Image.GetThumbnailImageAbort dummyCallBack = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
        System.Drawing.Image thumbNailImg = fullSizeImg.GetThumbnailImage(700, 800, dummyCallBack, IntPtr.Zero);
        thumbNailImg.Save(ImagePath, System.Drawing.Imaging.ImageFormat.Png);
        fullSizeImg.Dispose();
        thumbNailImg.Dispose();


    }
  • 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-23T12:49:33+00:00Added an answer on May 23, 2026 at 12:49 pm

    Bitmaps don’t have a size in inches, their size is measured in pixels. That said most modern bitmat formats have a piece of metadata called DPI (dots per inch) that is used to translate a size in pixels to a size in inches via the simple formula:

    inches = pixels / dpi
    

    For the Image class you set metadata using the SetPropertyItem Method where the pieces of metadata we are interested in are:

    • PropertyTagResolutionUnit – set this to “2” for inches
    • PropertyTagXResolution – Essentially the X DPI as long as PropertyTagResolutionUnit is in inches.
    • PropertyTagYResolution – The Y DPI as long as PropertyTagResolutionUnit is in inches

    See Property Item Descriptions for details.

    (Actually, I realised half way through writing this that the setting of property metadata using SetPropertyItem looks really complicated – you might just be better off using Bitmat instead, which has resolution properties making the whole thing a lot easier)

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

Sidebar

Related Questions

I am trying to save image captured from web cam with current time.Like 06.06.2010
I'm trying to save a copied image from the clipboard but it's losing its
In my app, I am trying to save and retrieval of an image in
I'm opening an image from the gallery, resizing it, and attempting to save the
It's me your junior programmer extraodinaire I'm trying to display an image from my
I am trying to automatically submit a form, and save the resulting image that
Im just trying to save a file to disk using a posted stream from
I'm trying to take an image, optimize it as a 65% jpeg and save
I'm trying to save some data to core data from a different view and
Im trying to save a bitmap jpg format with a specified encoding quality. However

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.