Convert Varbinary to Base 64 then to Image


I need help to convert varbinary code to image.

In order to achieve it i need help on the below steps.

  1. We need to convert to varbinary to base64
  2. Base 64 to image
  3. image to base 64
  4. base to varbinary

Need some help on this.

Hey @Manikandasamy.

  1. We need to convert to varbinary to base64:- Convert.ToBase64String Method (System) | Microsoft Learn
  2. Base 64 to image
string filePath = "MyImage.jpg";
File.WriteAllBytes(filePath, Convert.FromBase64String(base64imageString))
  1. image to base 64
byte[] imageArray = System.IO.File.ReadAllBytes(@"image file path");
string base64ImageRepresentation = Convert.ToBase64String(imageArray)


Hi, I achieved the point 2,3 . Need some examples to achieve point 1.

  1. Varbinary code to base64