Convert Base64 String to Image in C#

By: Syed  

This tutorial will help you to learn how we can convert base64 string back to image.
public Image Base64ToImage(string base64String)
  // Convert Base64 String to byte[]
  byte[] imageBytes = Convert.FromBase64String(base64String);
  MemoryStream ms = new MemoryStream(imageBytes, 0, 

  // Convert byte[] to Image
  ms.Write(imageBytes, 0, imageBytes.Length);
  Image image = Image.FromStream(ms, true);
  return image;

Archived Comments

1. the above code is not the time of retrunig image object paramerter invalid exception er
View Tutorial          By: Jayesh at 2016-05-27 07:17:07

2. Plz provide me code to convertbase64string to image example
View Tutorial          By: Naresh at 2015-12-24 11:01:50

3. How to Use Code in my Page ? plz give me the sugeestion
View Tutorial          By: jaty at 2015-08-19 12:25:20

4. hi
very tnx for your code

View Tutorial          By: Moji at 2012-08-19 16:06:53

5. good
View Tutorial          By: osman at 2011-11-21 22:23:02

Most Viewed Articles (in Csharp )

Latest Articles (in Csharp)

Comment on this tutorial