UtilImageToDataUri Method

Turns a System.Drawing.Image or System.Drawing.Bitmap into a DataUri which can used to embed the Image directly into an HTML document.

Read standard https://en.wikipedia.org/wiki/Data_URI_scheme

Namespace:  IronPdf
Assembly:  IronPdf (in IronPdf.dll) Version: 2020.6.0.0 (2020.6.0.0)
Syntax
public static string ImageToDataUri(
	Image Image,
	bool Rasterize = false
)

Parameters

Image
Type: System.DrawingImage
A non-null System.Drawing.Image or System.Drawing.Bitmap
Rasterize (Optional)
Type: SystemBoolean
Optional flag to flatten the image to raw pixels to increase compatibility with HTML (may affect PDF file size and rendering time)

Return Value

Type: String
A data URL which can be used as the src attribute of an HTML <img tag
See Also
Download DLL or Install with Nuget