# OfficeImageInfo

Bounded image metadata used by Office Open XML packages.

Class 

`OfficeIMO.Drawing`

**Namespace**

`OfficeIMO.Drawing`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[OfficeImageInfo.cs:11](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L11)

**Modifiers**

sealed

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](/api/core/officeimo-drawing-officeimageoptimizationresult/#property-final)
- Property [OfficeImageOptimizationResult.Original](/api/core/officeimo-drawing-officeimageoptimizationresult/#property-original)
- Method [OfficeImageReader.Identify](/api/core/officeimo-drawing-officeimagereader/#method-identify-string)

### Accepted by parameters 5

- Method [OfficeImageReader.NormalizeForEmbedding](/api/core/officeimo-drawing-officeimagereader/#method-normalizeforembedding-byte-officeimo-drawing-officerasterdecodeoptions-officeimo-drawing-officeimageinfo) parameter `info`
- Method [OfficeImageReader.TryIdentify](/api/core/officeimo-drawing-officeimagereader/#method-tryidentify-io-stream-string-officeimo-drawing-officeimageinfo) parameter `info`
- Method [OfficeImageReader.TryIdentifyByContent](/api/core/officeimo-drawing-officeimagereader/#method-tryidentifybycontent-io-stream-string-officeimo-drawing-officeimageinfo) parameter `info`
- Method [OfficeImageReader.TryReadBase64DataUri](/api/core/officeimo-drawing-officeimagereader/#method-tryreadbase64datauri-string-int64-byte-officeimo-drawing-officeimageinfo) parameter `info`
- Method [OfficeImageReader.TryValidateContent](/api/core/officeimo-drawing-officeimagereader/#method-tryvalidatecontent-io-stream-string-officeimo-drawing-officeimageinfo) parameter `info`

Filter members 

Show inherited

## Constructors

OfficeImageInfo 2 overloads

`public OfficeImageInfo(OfficeImageFormat format, int width, int height, double dpiX = 96, double dpiY = 96)` [#](#constructor-ctor-officeimo-drawing-officeimageformat-int32-int32-double-double)

[OfficeImageInfo.cs:11](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L11)

Creates a new image metadata value.

Parameters

**format OfficeIMO.Drawing.OfficeImageFormat required**

**width int required**

**height int required**

**dpiX double = 96 optional**

**dpiY double = 96 optional**

`public OfficeImageInfo(OfficeImageFormat format, int width, int height, double dpiX, double dpiY, double? aspectRatio)` [#](#constructor-ctor-officeimo-drawing-officeimageformat-int32-int32-double-double-nullable-system-double)

[OfficeImageInfo.cs:16](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L16)

Creates image metadata with an explicit intrinsic aspect ratio when dimensions alone cannot preserve it.

Parameters

**format OfficeIMO.Drawing.OfficeImageFormat required**

**width int required**

**height int required**

**dpiX double required**

**dpiY double required**

**aspectRatio double? required**

## Methods

`public static OfficeImageFormat FromMimeType(string? contentType)` [#](#method-frommimetype-string)

[OfficeImageInfo.cs:165](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L165)

Maps a MIME content type to a known image format.

Parameters

**contentType string? required**

MIME content type, optionally with parameters.

Returns

`OfficeImageFormat` The matching image format, or [OfficeImageFormat.Unknown](/api/core/officeimo-drawing-officeimageformat/) when unsupported.

`public static string GetDefaultExtension(OfficeImageFormat format)` [#](#method-getdefaultextension-officeimo-drawing-officeimageformat)

[OfficeImageInfo.cs:101](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L101)

Returns the canonical file extension for a known image format.

Parameters

**format OfficeIMO.Drawing.OfficeImageFormat required**

Image format.

Returns

`string` The default file extension including the leading dot, or .bin for unknown formats.

`public static string GetMimeType(OfficeImageFormat format)` [#](#method-getmimetype-officeimo-drawing-officeimageformat)

[OfficeImageInfo.cs:74](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L74)

Returns the default MIME type for a known image format.

Parameters

**format OfficeIMO.Drawing.OfficeImageFormat required**

Image format.

Returns

`string` The default MIME content type, or application/octet-stream for unknown formats.

`public static string GetMimeTypeFromExtension(string? fileName)` [#](#method-getmimetypefromextension-string)

[OfficeImageInfo.cs:129](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L129)

Returns the default MIME type for an image file name or extension.

Parameters

**fileName string? required**

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)` [#](#method-isbrowserpreviewsafecontenttype-string)

[OfficeImageInfo.cs:149](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L149)

Returns whether the image MIME content type is safe for inline HTML preview galleries.

Parameters

**contentType string? required**

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)` [#](#method-isbrowserpreviewsafeextension-string)

[OfficeImageInfo.cs:157](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L157)

Returns whether the image file name or extension is safe for inline HTML preview galleries.

Parameters

**fileName string? required**

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)` [#](#method-isbrowserpreviewsafeformat-officeimo-drawing-officeimageformat)

[OfficeImageInfo.cs:137](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L137)

Returns whether the image format is safe for inline HTML preview galleries.

Parameters

**format OfficeIMO.Drawing.OfficeImageFormat required**

Image format.

Returns

`bool` true when the format can be previewed inline without embedding active SVG markup.

`public static string NormalizeMimeType(string? contentType)` [#](#method-normalizemimetype-string)

[OfficeImageInfo.cs:219](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L219)

Normalizes a MIME content type by removing parameters and applying case-insensitive comparison casing.

Parameters

**contentType string? required**

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)` [#](#method-trynormalizeimagecontenttype-string-string)

[OfficeImageInfo.cs:200](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L200)

Tries to normalize an image MIME content type by trimming parameters and canonicalizing known aliases.

Parameters

**contentType string? required**

MIME content type, optionally with parameters.

**normalizedContentType string required**

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

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public OfficeImageFormat Format { get; }` [#](#property-format)

[OfficeImageInfo.cs:33](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L33)

Image format.

`public int Width { get; }` [#](#property-width)

[OfficeImageInfo.cs:36](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L36)

Width in pixels, or 0 when unknown.

`public int Height { get; }` [#](#property-height)

[OfficeImageInfo.cs:39](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L39)

Height in pixels, or 0 when unknown.

`public double DpiX { get; }` [#](#property-dpix)

[OfficeImageInfo.cs:42](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L42)

Horizontal resolution in DPI. Defaults to 96 when absent.

`public double DpiY { get; }` [#](#property-dpiy)

[OfficeImageInfo.cs:45](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L45)

Vertical resolution in DPI. Defaults to 96 when absent.

`public double? AspectRatio { get; }` [#](#property-aspectratio)

[OfficeImageInfo.cs:48](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L48)

Intrinsic width-to-height ratio when known independently of complete pixel dimensions.

`public int? JpegComponentCount { get; internal set; }` [#](#property-jpegcomponentcount)

[OfficeImageInfo.cs:57](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L57)

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; }` [#](#property-tiffphotometricinterpretation)

[OfficeImageInfo.cs:64](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L64)

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.

`public string MimeType { get; }` [#](#property-mimetype)

[OfficeImageInfo.cs:67](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeImageInfo.cs#L67)

Default MIME type for the detected format.

<!-- PowerForge markdown artifact sha256:2C2573D4DC3CC872BAACB43F327FEC44A1850B2F510BDA4545DF6CDEDD35F4C9 -->
