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 https://en.wikipedia.org/wiki/Data_URI_scheme

Namespace:  IronPdf
Assembly:  IronPdf (in IronPdf.dll) Version: 4.4.2.27556 (4.4.4.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