Table of Contents

Class ImageUtils

Namespace
C4.Net.Util
Assembly
C4.Net.Core.dll

Provides helpers for reading supported documentation image files.

public class ImageUtils
Inheritance
ImageUtils
Inherited Members

Methods

GetContentType(FileInfo)

Resolves the MIME type for a supported image file.

public static string GetContentType(FileInfo file)

Parameters

file FileInfo

The image file to inspect.

Returns

string

The MIME type for the image.

Exceptions

ArgumentException

Thrown when file is missing, is a directory, does not exist, or is not a supported image type.

GetImageAsBase64(FileInfo)

Reads a supported image file and returns its Base64-encoded bytes.

public static string GetImageAsBase64(FileInfo file)

Parameters

file FileInfo

The image file to read.

Returns

string

The Base64-encoded image content.

Exceptions

ArgumentException

Thrown when file is missing, invalid, or unsupported.

GetImageAsDataUri(FileInfo)

Reads a supported image file and returns it as a data URI.

public static string GetImageAsDataUri(FileInfo file)

Parameters

file FileInfo

The image file to read.

Returns

string

A data URI that embeds the image content.

Exceptions

ArgumentException

Thrown when file is missing, invalid, or unsupported.