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!
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:
If you want to display it dynamically in ASP.NET you could write a generic handler that will serve this image:
and in some web form where you want to display it you could use an image control pointing to this handler:
or a simple static
<img>tag if you prefer:Yet another possibility is to use the Data URI scheme (assuming your client browsers support it):
where the
MyImageDatafunction could be defined in your code behind: