Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 518 Bytes

create-stream-from-base64-string.md

File metadata and controls

16 lines (13 loc) · 518 Bytes

Create Stream from a Base64 String

Make sure your image data does not contain some header information at the beginning:

imageCode = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABkC...

This will cause an error. Just remove everything in front of and including the first comma, and you good to go.

imageCode = "iVBORw0KGgoAAAANSUhEUgAAAMgAAABkC...

Covert base64 image to a stream

Stream memStream = new MemoryStream(Convert.FromBase64String(base64StringData));