Click here to Skip to main content
15,662,484 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
C#
Convert from binary data to an image control in ASP.NET
Posted

1 solution

If the binary data contains a "known" image type (.JPG, .BMP, .PNG, ...) then it's easy:
C#
MemoryStream ms = new MemoryStream(bytes);
Image im = Image.FromStream(ms);

If it doesn't, but contains a (for example) proprietary graphics format that the framework doesn't support, then you will have to find or write a converter to read the graphics info and generate an Image from it. We can't help with that: we have no access to your binary data and do not know what it contains.

If you do write your own loader, then it would probably be worth writing an article on the process and publishing it here: Submit a new Article - CodeProject[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900