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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:06:15+00:00 2026-05-28T01:06:15+00:00

How can I convert the following Binary value to Bitmap image in ASP.NET C#

  • 0

How can I convert the following Binary value to Bitmap image in ASP.NET C#

89504e470d0a1a0a0000000d4948445200000103000000cf0806000000f18cb4b00000000473424954080808087c086488000000097048597300000b1200000b1201d2dd7efc00000016744558744372656174696f6e2054696d650031322f32372f3131cce39cd90000002674455874536f667477617265005245534f5552434553204e4f54205553454420464f5220454e47494e45f6c2e0720000200049444154789cec9d779c5d5775efbffbf473fb748d7aefdd922c775bd84e6c638a1d20b4600831844e48422f2f24218440c80b2fe5250412420fa1d9e082255bb66cc956b7ba2c8d6634bddeb9fdb4bddf1fe76a2cd932312f8065657e9fcffd7c

None of the similar question’s answered helped me. Anybody please help!

  • 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-28T01:06:15+00:00Added an answer on May 28, 2026 at 1:06 am

    Looks like a PNG image (it’s a 100×100 transparent pixels only image). You could use the following function to convert this HEX string into a byte array and save it to a file:

    class Program
    {
        static void Main()
        {
            var data = "89504e470d0a1a0a0000000d4948445200000103000000cf0806000000f18cb4b00000000473424954080808087c086488000000097048597300000b1200000b1201d2dd7efc00000016744558744372656174696f6e2054696d650031322f32372f3131cce39cd90000002674455874536f667477617265005245534f5552434553204e4f54205553454420464f5220454e47494e45f6c2e0720000200049444154789cec9d779c5d5775efbffbf473fb748d7aefdd922c775bd84e6c638a1d20b4600831844e48422f2f24218440c80b2fe5250412420fa1d9e082255bb66cc956b7ba2c8d6634bddeb9fdb4bddf1fe76a2cd932312f8065657e9fcffd7c";
            var buffer = StringToByteArray(data);
            File.WriteAllBytes("test.png", buffer);
        }
    
        static byte[] StringToByteArray(string hex)
        {
            return Enumerable
                .Range(0, hex.Length)
                .Where(x => x % 2 == 0)
                .Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
                .ToArray();
        }
    }
    

    If you want to display it dynamically in ASP.NET you could write a generic handler that will serve this image:

    public class MyImage : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "image/png";
            var data = "89504e470d0a1a0a0000000d4948445200000103000000cf0806000000f18cb4b00000000473424954080808087c086488000000097048597300000b1200000b1201d2dd7efc00000016744558744372656174696f6e2054696d650031322f32372f3131cce39cd90000002674455874536f667477617265005245534f5552434553204e4f54205553454420464f5220454e47494e45f6c2e0720000200049444154789cec9d779c5d5775efbffbf473fb748d7aefdd922c775bd84e6c638a1d20b4600831844e48422f2f24218440c80b2fe5250412420fa1d9e082255bb66cc956b7ba2c8d6634bddeb9fdb4bddf1fe76a2cd932312f8065657e9fcffd7c";
            var buffer = StringToByteArray(data);
            context.Response.OutputStream.Write(buffer, 0, buffer.Length);
        }
    
        private byte[] StringToByteArray(string hex)
        {
            return Enumerable
                .Range(0, hex.Length)
                .Where(x => x % 2 == 0)
                .Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
                .ToArray();
        }
    
        public bool IsReusable
        {
            get { return false; }
        }
    }
    

    and in some web form where you want to display it you could use an image control pointing to this handler:

    <asp:Image ID="img" runat="server" ImageUrl="~/MyImage.ashx" />
    

    or a simple static <img> tag if you prefer:

    <img src="<%= ResolveUrl("~/MyImage.ashx") %>" alt="" />
    

    Yet another possibility is to use the Data URI scheme (assuming your client browsers support it):

    <img src="data:image/png;base64,<%= MyImageData() %>" alt="" />
    

    where the MyImageData function could be defined in your code behind:

    public partial class _Default : System.Web.UI.Page
    {
        protected string MyImageData()
        {
            var data = "89504e470d0a1a0a0000000d4948445200000103000000cf0806000000f18cb4b00000000473424954080808087c086488000000097048597300000b1200000b1201d2dd7efc00000016744558744372656174696f6e2054696d650031322f32372f3131cce39cd90000002674455874536f667477617265005245534f5552434553204e4f54205553454420464f5220454e47494e45f6c2e0720000200049444154789cec9d779c5d5775efbffbf473fb748d7aefdd922c775bd84e6c638a1d20b4600831844e48422f2f24218440c80b2fe5250412420fa1d9e082255bb66cc956b7ba2c8d6634bddeb9fdb4bddf1fe76a2cd932312f8065657e9fcffd7c";
            var buffer = StringToByteArray(data);
            return Convert.ToBase64String(buffer);
        }
    
        private byte[] StringToByteArray(string hex)
        {
            return Enumerable
                .Range(0, hex.Length)
                .Where(x => x % 2 == 0)
                .Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
                .ToArray();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can we convert the following 64 bit binary into the long equivalent; 01111101
How can I convert the following struct to unsigned char* ? typedef struct {
How can you convert the following command for Ubuntu's ZSH? DavidPashley 's command for
Is there some tool that can automatically convert the following c style code A
If I do the following I can convert from a time_struct object to a
Trying to convert the following but am having difficulty. Can anyone see where I'm
I'm trying to convert the following list into a select list so it can
we can convert character to an integer equivalent to the ASCII value of the
I want to send a binary file to .net c# component in the following
How can I convert ASCII values to hexadecimal and binary values (not their string

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.