Embedding Bitmaps and Images
To embed an image in HTML using base64 encoding, you need to acquire the binary data of the image either by reading the image file or receiving it through a network request. Afterward, convert the binary data to base64 using the Convert.ToBase64String
method in Microsoft .NET. When constructing the image tag in HTML, prepend "data:image/svg+xml;base64," before the base64 data. Note that specifying the image type before the base64 data is essential. For further details on image format types, refer to the MDN Web Docs.
Discover more ways to add images in the following article: How to Add Images to PDFs.