0

I have an html file which I want to convert it's images from local source to base64 using C#.

<img width=83 height=100
  src="Untitled_files/image001.png" alt="cid:image003.png@01D3405F.B71FED30"
  v:shapes="Picture_x0020_1">

It'll be appreciated if you help me.

1 Answers1

0

Read the file's bytes and then convert it to base64:

byte[] imageArray =  System.IO.File.ReadAllBytes(@"image path");
string base64 = Convert.ToBase64String(imageArray);

If the file is not local, you will need to download it.

CodingYoshi
  • 25,467
  • 4
  • 62
  • 64