Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

OfficeImageInfo

OfficeIMO.Drawing

Namespace
OfficeIMO.Drawing
Assembly
OfficeIMO.Core
Source revision
ba882f6b0d07 with working tree changes
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.

Accepted by parameters 5

Constructors

OfficeImageInfo 2 overloads
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 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) #

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) #

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 when unsupported.
public static string GetDefaultExtension(OfficeImageFormat format) #

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) #

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) #

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) #

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) #

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) #

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) #

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) #

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.

Properties

public OfficeImageFormat Format { get; } #

Image format.

public int Width { get; } #

Width in pixels, or 0 when unknown.

public int Height { get; } #

Height in pixels, or 0 when unknown.

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.

public string MimeType { get; } #

Default MIME type for the detected format.