Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

API Reference

Class

OfficeImageInfo

Namespace OfficeIMO.Drawing
Assembly OfficeIMO.Core
Modifiers sealed

Bounded image metadata used by Office Open XML packages.

Inheritance

  • Object
  • OfficeImageInfo

Usage

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Constructors

OfficeImageInfo 2 overloads
public OfficeImageInfo(OfficeImageFormat format, Int32 width, Int32 height, Double dpiX = 96, Double dpiY = 96) #

Creates a new image metadata value.

Parameters

format OfficeIMO.Drawing.OfficeImageFormat requiredposition: 0
width System.Int32 requiredposition: 1
height System.Int32 requiredposition: 2
dpiX System.Double = 96 optionalposition: 3
dpiY System.Double = 96 optionalposition: 4
public OfficeImageInfo(OfficeImageFormat format, Int32 width, Int32 height, Double dpiX, Double dpiY, Nullable<Double> aspectRatio) #

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

Parameters

format OfficeIMO.Drawing.OfficeImageFormat requiredposition: 0
width System.Int32 requiredposition: 1
height System.Int32 requiredposition: 2
dpiX System.Double requiredposition: 3
dpiY System.Double requiredposition: 4
aspectRatio System.Nullable{System.Double} requiredposition: 5

Methods

public static OfficeImageFormat FromMimeType(String contentType) #
Returns: OfficeImageFormat

Maps a MIME content type to a known image format.

Parameters

contentType System.String requiredposition: 0
MIME content type, optionally with parameters.

Returns

The matching image format, or Unknown when unsupported.

public static String GetDefaultExtension(OfficeImageFormat format) #
Returns: String

Returns the canonical file extension for a known image format.

Parameters

format OfficeIMO.Drawing.OfficeImageFormat requiredposition: 0
Image format.

Returns

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

public static String GetMimeType(OfficeImageFormat format) #
Returns: String

Returns the default MIME type for a known image format.

Parameters

format OfficeIMO.Drawing.OfficeImageFormat requiredposition: 0
Image format.

Returns

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

public static String GetMimeTypeFromExtension(String fileName) #
Returns: String

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

Parameters

fileName System.String requiredposition: 0
File name, path, or bare extension.

Returns

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

public static Boolean IsBrowserPreviewSafeContentType(String contentType) #
Returns: Boolean

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

Parameters

contentType System.String requiredposition: 0
MIME content type, optionally with parameters.

Returns

true when the content type maps to an inline-preview-safe image format.

public static Boolean IsBrowserPreviewSafeExtension(String fileName) #
Returns: Boolean

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

Parameters

fileName System.String requiredposition: 0
File name, path, or bare extension.

Returns

true when the extension maps to an inline-preview-safe image format.

public static Boolean IsBrowserPreviewSafeFormat(OfficeImageFormat format) #
Returns: Boolean

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

Parameters

format OfficeIMO.Drawing.OfficeImageFormat requiredposition: 0
Image format.

Returns

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

public static String NormalizeMimeType(String contentType) #
Returns: String

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

Parameters

contentType System.String requiredposition: 0
MIME content type, optionally with parameters.

Returns

The normalized MIME content type, or an empty string for missing values.

public static Boolean TryNormalizeImageContentType(String contentType, out String normalizedContentType) #
Returns: Boolean

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

Parameters

contentType System.String requiredposition: 0
MIME content type, optionally with parameters.
normalizedContentType System.String@ requiredposition: 1
Canonical image MIME type for known formats, or the normalized image MIME type for unknown image formats.

Returns

true when the value is an image MIME type.

Properties

public OfficeImageFormat Format { get; } #

Image format.

public Int32 Width { get; } #

Width in pixels, or 0 when unknown.

public Int32 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 Nullable<Double> AspectRatio { get; } #

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

public String MimeType { get; } #

Default MIME type for the detected format.