Click or drag to resize

UtilImageToDataUri Method

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

Read standard

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


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