OfficeImageInfo
OfficeIMO.Drawing
Bounded image metadata used by Office Open XML packages.
Inheritance
- object
- OfficeImageInfo
Usage
Explore 8 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 3
- Property OfficeImageOptimizationResult.Final
- Property OfficeImageOptimizationResult.Original
- Method OfficeImageReader.Identify
Accepted by parameters 5
Constructors
public OfficeImageInfo(OfficeImageFormat format, int width, int height, double dpiX = 96, double dpiY = 96) #Creates a new image metadata value.
Parameters
- format OfficeIMO.Drawing.OfficeImageFormat
- width int
- height int
- dpiX double = 96
- dpiY double = 96
public OfficeImageInfo(OfficeImageFormat format, int width, int height, double dpiX, double dpiY, double? aspectRatio) #Creates image metadata with an explicit intrinsic aspect ratio when dimensions alone cannot preserve it.
Parameters
- format OfficeIMO.Drawing.OfficeImageFormat
- width int
- height int
- dpiX double
- dpiY double
- aspectRatio double?
Methods
public static OfficeImageFormat FromMimeType(string? contentType) #Maps a MIME content type to a known image format.
Parameters
- contentType string?
- MIME content type, optionally with parameters.
public static string GetDefaultExtension(OfficeImageFormat format) #Returns the canonical file extension for a known image format.
Parameters
- format OfficeIMO.Drawing.OfficeImageFormat
- Image format.
Returns
string The default file extension including the leading dot, or .bin for unknown formats.public static string GetMimeType(OfficeImageFormat format) #Returns the default MIME type for a known image format.
Parameters
- format OfficeIMO.Drawing.OfficeImageFormat
- Image format.
Returns
string The default MIME content type, or application/octet-stream for unknown formats.public static string GetMimeTypeFromExtension(string? fileName) #Returns the default MIME type for an image file name or extension.
Parameters
- fileName string?
- File name, path, or bare extension.
Returns
string The default MIME content type, or application/octet-stream for unknown formats.public static bool IsBrowserPreviewSafeContentType(string? contentType) #Returns whether the image MIME content type is safe for inline HTML preview galleries.
Parameters
- contentType string?
- MIME content type, optionally with parameters.
Returns
bool true when the content type maps to an inline-preview-safe image format.public static bool IsBrowserPreviewSafeExtension(string? fileName) #Returns whether the image file name or extension is safe for inline HTML preview galleries.
Parameters
- fileName string?
- File name, path, or bare extension.
Returns
bool true when the extension maps to an inline-preview-safe image format.public static bool IsBrowserPreviewSafeFormat(OfficeImageFormat format) #Returns whether the image format is safe for inline HTML preview galleries.
Parameters
- format OfficeIMO.Drawing.OfficeImageFormat
- Image format.
Returns
bool true when the format can be previewed inline without embedding active SVG markup.public static string NormalizeMimeType(string? contentType) #Normalizes a MIME content type by removing parameters and applying case-insensitive comparison casing.
Parameters
- contentType string?
- MIME content type, optionally with parameters.
Returns
string The normalized MIME content type, or an empty string for missing values.public static bool TryNormalizeImageContentType(string? contentType, out string normalizedContentType) #Tries to normalize an image MIME content type by trimming parameters and canonicalizing known aliases.
Parameters
- contentType string?
- MIME content type, optionally with parameters.
- normalizedContentType string
- Canonical image MIME type for known formats, or the normalized image MIME type for unknown image formats.
Returns
bool true when the value is an image MIME type.Inherited Methods
Properties
public double DpiX { get; } #Horizontal resolution in DPI. Defaults to 96 when absent.
public double DpiY { get; } #Vertical resolution in DPI. Defaults to 96 when absent.
public double? AspectRatio { get; } #Intrinsic width-to-height ratio when known independently of complete pixel dimensions.
public int? JpegComponentCount { get; internal set; } #Component count declared by a JPEG frame header, or null when unavailable or not JPEG. Three components alone do not establish RGB, an ICC profile, or valid pixel data.
public int? TiffPhotometricInterpretation { get; internal set; } #Raw TIFF PhotometricInterpretation (tag 262) from the first image directory. Null means absent, malformed, duplicated, or not TIFF. For example, 2 declares RGB and 5 declares separated samples. This is header evidence, not ICC or payload validation.