Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

OfficeImageMetadata

OfficeIMO.Drawing

Namespace
OfficeIMO.Drawing
Assembly
OfficeIMO.Core
Source revision
339caf644fc0 with working tree changes
Modifiers
sealed

Portable image metadata with typed Exif edits and independently owned profile bytes.

Inheritance

  • object
  • OfficeImageMetadata

Remarks

Metadata edits do not apply ICC color transformations to image pixels. Use OfficeImageMetadata.Apply to replace supported container metadata without recompressing image data.

Usage

Explore 10 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

public OfficeImageMetadata() #

Methods

public static byte[] Apply(byte[] encodedBytes, OfficeImageMetadata metadata, CancellationToken cancellationToken = default) #

Replaces supported primary-image profiles and density without recompressing image pixels.

Parameters

encodedBytes byte[] required
metadata OfficeIMO.Drawing.OfficeImageMetadata required
cancellationToken System.Threading.CancellationToken = default optional

Returns

byte[]
public OfficeRasterEncodingResult ApplyForEncoding(byte[] encodedBytes, OfficeRasterEncodingOptions? options = null, long maximumEncodedBytes = 134217728, CancellationToken cancellationToken = default) #

Projects and applies this metadata to an already encoded managed raster container.

Parameters

encodedBytes byte[] required
A complete encoded raster container, including externally encoded GIF or APNG animation.
options OfficeIMO.Drawing.OfficeRasterEncodingOptions? = null optional
Resolution override and density-writing policy only; compression settings cannot alter already encoded pixels. The shared write switch suppresses native and Exif density. PNG's switch suppresses pHYs, and JPEG's switch suppresses JFIF; both retain supplied Exif density. TIFF and WebP store density in Exif, so their switches suppress those density tags.
maximumEncodedBytes long = 134217728 optional
Positive ceiling for the complete rewritten container, at most 128 MiB.
cancellationToken System.Threading.CancellationToken = default optional
Cancellation observed during inspection and rewriting.

Returns

OfficeRasterEncodingResult Owned rewritten bytes, the applied projection, and unsupported supplied profile-family omissions.
public void ClearExif() #

Removes the entire Exif profile, including opaque and thumbnail data.

public OfficeImageMetadata Clone() #

Creates an independent copy of profiles, typed fields, pending edits, and TIFF preservation constraints.

EncodeExifProfile 2 overloads
public byte[]? EncodeExifProfile() #

Returns a classic TIFF profile containing the current edits, or null when Exif is absent.

Returns

byte[]?
public byte[]? EncodeExifProfile(CancellationToken cancellationToken) #

Encodes classic TIFF Exif metadata while observing cancellation during directory and value processing.

Parameters

cancellationToken System.Threading.CancellationToken required

Returns

byte[]?
public OfficeExifValue? GetExifValue(OfficeExifTag tag) #

Returns a typed field, or null when absent.

Parameters

tag OfficeIMO.Drawing.OfficeExifTag required
public static OfficeImageMetadataInspection Inspect(byte[] encodedBytes, OfficeImageMetadataInspectionOptions? options = null, CancellationToken cancellationToken = default) #

Inspects supported encoded image metadata without editing the input or decoding pixels.

Parameters

encodedBytes byte[] required
options OfficeIMO.Drawing.OfficeImageMetadataInspectionOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Exceptions

public static OfficeImageMetadataInspection InspectExifProfile(byte[] profile, OfficeImageMetadataInspectionOptions? options = null, CancellationToken cancellationToken = default) #

Inspects a standalone classic TIFF Exif profile, optionally including JPEG Exif framing.

Parameters

profile byte[] required
options OfficeIMO.Drawing.OfficeImageMetadataInspectionOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Exceptions

ParseExifProfile 2 overloads
public static OfficeImageMetadata ParseExifProfile(byte[] profile) #

Reads a classic TIFF Exif profile or a JPEG-prefixed Exif profile.

Parameters

profile byte[] required
public static OfficeImageMetadata ParseExifProfile(byte[] profile, CancellationToken cancellationToken) #

Reads classic TIFF or JPEG-prefixed Exif metadata while observing cancellation.

Parameters

profile byte[] required
cancellationToken System.Threading.CancellationToken required
public OfficeImageMetadata PrepareForEncoding(OfficeImageFormat format, out OfficeImageMetadataProfileKinds omittedProfiles) #

Creates an independent metadata copy containing only profile families carried by the destination format.

Parameters

format OfficeIMO.Drawing.OfficeImageFormat required
The destination image container.
omittedProfiles OfficeIMO.Drawing.OfficeImageMetadataProfileKinds required
Profile families present in this metadata that the destination cannot carry.

Returns

OfficeImageMetadata An independent metadata copy suitable for the destination's supported profile families.
public static OfficeImageMetadata Read(byte[] encodedBytes, CancellationToken cancellationToken = default) #

Reads image profiles and physical resolution from a supported encoded image.

Parameters

encodedBytes byte[] required
cancellationToken System.Threading.CancellationToken = default optional
public static OfficeImageMetadataRemovalResult Remove(byte[] encodedBytes, OfficeImageMetadataProfileKinds kinds, CancellationToken cancellationToken = default) #

Removes selected supported profile families while preserving encoded image payloads, frame timing, and TIFF pages.

Parameters

encodedBytes byte[] required
kinds OfficeIMO.Drawing.OfficeImageMetadataProfileKinds required
cancellationToken System.Threading.CancellationToken = default optional
public bool RemoveExifValue(OfficeExifTag tag) #

Removes a field and returns whether it was present.

Parameters

tag OfficeIMO.Drawing.OfficeExifTag required

Returns

bool
public void SetExifValue(OfficeExifTag tag, object value) #

Sets an Exif scalar, text, rational, or typed array using the tag's representation.

Parameters

tag OfficeIMO.Drawing.OfficeExifTag required
value object required

Properties

public double HorizontalResolution { get; set; } #

Horizontal resolution in OfficeImageMetadata.ResolutionUnits.

public double VerticalResolution { get; set; } #

Vertical resolution in OfficeImageMetadata.ResolutionUnits.

public OfficeImageResolutionUnit ResolutionUnits { get; set; } #

The unit for both resolution values.

public OfficeImageResolution Resolution { get; set; } #

The authoritative native density or unitless aspect ratio, suitable for encoder overrides.

public double? PhysicalDpiX { get; } #

Horizontal physical resolution in dots per inch, or null for a unitless aspect ratio.

public double? PhysicalDpiY { get; } #

Vertical physical resolution in dots per inch, or null for a unitless aspect ratio.

public bool HasExifProfile { get; } #

Whether any Exif fields or an opaque Exif profile are present.

public bool RequiresOriginalTiffContainer { get; } #

Whether TIFF-relative opaque fields require their original TIFF container for safe preservation.

public byte[]? ExifProfile { get; set; } #

Classic TIFF Exif profile without a JPEG Exif prefix. Setting a profile replaces all pending Exif edits.

public byte[]? XmpProfile { get; set; } #

XMP XML packet, excluding container framing. Profile arrays are copied.

public byte[]? IccProfile { get; set; } #

ICC profile bytes. Profile arrays are copied.

public byte[]? IptcProfile { get; set; } #

IPTC IIM data, excluding Photoshop resource framing. Profile arrays are copied.

public IReadOnlyList<OfficeExifValue> ExifValues { get; } #

Current Exif values from the image, camera, GPS, and interoperability directories.