# OfficeImageMetadata

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

Class 

`OfficeIMO.Drawing`

**Namespace**

`OfficeIMO.Drawing`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`7fbbd72e7c5a` with working tree changes

**Source**

[OfficeImageMetadata.cs:19](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L19)

**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](/api/core/officeimo-drawing-officeimagemetadata/) 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.

### Returned or exposed by 5

- Method [OfficeImageMetadata.Clone](/api/core/officeimo-drawing-officeimagemetadata/#method-clone)
- Method [OfficeImageMetadata.ParseExifProfile](/api/core/officeimo-drawing-officeimagemetadata/#method-parseexifprofile-byte)
- Method [OfficeImageMetadata.PrepareForEncoding](/api/core/officeimo-drawing-officeimagemetadata/#method-prepareforencoding-officeimo-drawing-officeimageformat-officeimo-drawing-officeimagemetadataprofilekinds)
- Method [OfficeImageMetadata.Read](/api/core/officeimo-drawing-officeimagemetadata/#method-read-byte-threading-cancellationtoken)
- Property [OfficeRasterEncodingResult.Metadata](/api/core/officeimo-drawing-officerasterencodingresult/#property-metadata)

### Accepted by parameters 5

- Method [OfficeHeifMetadataReader.TryReadExifProfile](/api/core/officeimo-drawing-officeheifmetadatareader/#method-tryreadexifprofile-byte-officeimo-drawing-officeimagemetadata-threading-cancellationtoken) parameter `profile`
- Method [OfficeHeifMetadataReader.TryWriteExifProfile](/api/core/officeimo-drawing-officeheifmetadatareader/#method-trywriteexifprofile-byte-officeimo-drawing-officeimagemetadata-byte-threading-cancellationtoken) parameter `profile`
- Method [OfficeHeifMetadataReader.TryWriteMetadata](/api/core/officeimo-drawing-officeheifmetadatareader/#method-trywritemetadata-byte-officeimo-drawing-officeimagemetadata-officeimo-drawing-officeimagemetadataprofilekinds-byte-threading-cancellationtoken) parameter `metadata`
- Method [OfficeImageMetadata.Apply](/api/core/officeimo-drawing-officeimagemetadata/#method-apply-byte-officeimo-drawing-officeimagemetadata-threading-cancellationtoken) parameter `metadata`
- Method [OfficeRasterImageEncoder.EncodeWithMetadata](/api/core/officeimo-drawing-officerasterimageencoder/#method-encodewithmetadata-officeimo-drawing-officerasterimage-officeimo-drawing-officeimageexportformat-officeimo-drawing-officeimagemetadata-officeimo-drawing-officerasterencodingoptions-int64-threading-cancellationtoken) parameter `metadata`

Filter members 

Show inherited

## Constructors

`public OfficeImageMetadata()` [#](#constructor-ctor)

[OfficeImageMetadata.cs:19](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L19)

## Methods

`public static byte[] Apply(byte[] encodedBytes, OfficeImageMetadata metadata, CancellationToken cancellationToken = default)` [#](#method-apply-byte-officeimo-drawing-officeimagemetadata-threading-cancellationtoken)

[OfficeImageMetadata.cs:184](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L184)

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)` [#](#method-applyforencoding-byte-officeimo-drawing-officerasterencodingoptions-int64-threading-cancellationtoken)

[OfficeImageMetadata.ApplyForEncoding.cs:20](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.ApplyForEncoding.cs#L20)

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

[OfficeImageMetadata.cs:111](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L111)

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

`public OfficeImageMetadata Clone()` [#](#method-clone)

[OfficeImageMetadata.cs:149](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L149)

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

Returns

`OfficeImageMetadata`

EncodeExifProfile 2 overloads

`public byte[]? EncodeExifProfile()` [#](#method-encodeexifprofile)

[OfficeImageMetadata.cs:114](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L114)

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

Returns

`byte[]?`

`public byte[]? EncodeExifProfile(CancellationToken cancellationToken)` [#](#method-encodeexifprofile-threading-cancellationtoken)

[OfficeImageMetadata.cs:116](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L116)

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

[OfficeImageMetadata.cs:85](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L85)

Returns a typed field, or null when absent.

Parameters

**tag OfficeIMO.Drawing.OfficeExifTag required**

Returns

`OfficeExifValue?`

`public static OfficeImageMetadataInspection Inspect(byte[] encodedBytes, OfficeImageMetadataInspectionOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-inspect-byte-officeimo-drawing-officeimagemetadatainspectionoptions-threading-cancellationtoken)

[OfficeImageMetadata.Inspection.cs:12](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.Inspection.cs#L12)

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**

Returns

`OfficeImageMetadataInspection`

Exceptions

- `OfficeInspectionResourceLimitException` – The configured metadata input-byte ceiling was exceeded.

`public static OfficeImageMetadataInspection InspectExifProfile(byte[] profile, OfficeImageMetadataInspectionOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-inspectexifprofile-byte-officeimo-drawing-officeimagemetadatainspectionoptions-threading-cancellationtoken)

[OfficeImageMetadata.Inspection.cs:95](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.Inspection.cs#L95)

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**

Returns

`OfficeImageMetadataInspection`

Exceptions

- `OfficeInspectionResourceLimitException` – The configured metadata input-byte ceiling was exceeded.

ParseExifProfile 2 overloads

`public static OfficeImageMetadata ParseExifProfile(byte[] profile)` [#](#method-parseexifprofile-byte)

[OfficeImageMetadata.cs:123](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L123)

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

Parameters

**profile byte[] required**

Returns

`OfficeImageMetadata`

`public static OfficeImageMetadata ParseExifProfile(byte[] profile, CancellationToken cancellationToken)` [#](#method-parseexifprofile-byte-threading-cancellationtoken)

[OfficeImageMetadata.cs:126](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L126)

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

Parameters

**profile byte[] required**

**cancellationToken System.Threading.CancellationToken required**

Returns

`OfficeImageMetadata`

`public OfficeImageMetadata PrepareForEncoding(OfficeImageFormat format, out OfficeImageMetadataProfileKinds omittedProfiles)` [#](#method-prepareforencoding-officeimo-drawing-officeimageformat-officeimo-drawing-officeimagemetadataprofilekinds)

[OfficeImageMetadata.Encoding.cs:10](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.Encoding.cs#L10)

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)` [#](#method-read-byte-threading-cancellationtoken)

[OfficeImageMetadata.cs:158](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L158)

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

Parameters

**encodedBytes byte[] required**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`OfficeImageMetadata`

`public static OfficeImageMetadataRemovalResult Remove(byte[] encodedBytes, OfficeImageMetadataProfileKinds kinds, CancellationToken cancellationToken = default)` [#](#method-remove-byte-officeimo-drawing-officeimagemetadataprofilekinds-threading-cancellationtoken)

[OfficeImageMetadata.Containers.cs:48](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.Containers.cs#L48)

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**

Returns

`OfficeImageMetadataRemovalResult`

`public bool RemoveExifValue(OfficeExifTag tag)` [#](#method-removeexifvalue-officeimo-drawing-officeexiftag)

[OfficeImageMetadata.cs:105](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L105)

Removes a field and returns whether it was present.

Parameters

**tag OfficeIMO.Drawing.OfficeExifTag required**

Returns

`bool`

`public void SetExifValue(OfficeExifTag tag, object value)` [#](#method-setexifvalue-officeimo-drawing-officeexiftag-object)

[OfficeImageMetadata.cs:89](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L89)

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

Parameters

**tag OfficeIMO.Drawing.OfficeExifTag required**

**value object required**

## 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 double HorizontalResolution { get; set; }` [#](#property-horizontalresolution)

[OfficeImageMetadata.cs:28](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L28)

Horizontal resolution in [OfficeImageMetadata.ResolutionUnits](/api/core/officeimo-drawing-officeimagemetadata/).

`public double VerticalResolution { get; set; }` [#](#property-verticalresolution)

[OfficeImageMetadata.cs:30](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L30)

Vertical resolution in [OfficeImageMetadata.ResolutionUnits](/api/core/officeimo-drawing-officeimagemetadata/).

`public OfficeImageResolutionUnit ResolutionUnits { get; set; }` [#](#property-resolutionunits)

[OfficeImageMetadata.cs:32](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L32)

The unit for both resolution values.

`public OfficeImageResolution Resolution { get; set; }` [#](#property-resolution)

[OfficeImageMetadata.cs:38](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L38)

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

`public double? PhysicalDpiX { get; }` [#](#property-physicaldpix)

[OfficeImageMetadata.cs:47](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L47)

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

`public double? PhysicalDpiY { get; }` [#](#property-physicaldpiy)

[OfficeImageMetadata.cs:49](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L49)

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

`public bool HasExifProfile { get; }` [#](#property-hasexifprofile)

[OfficeImageMetadata.cs:51](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L51)

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

`public bool RequiresOriginalTiffContainer { get; }` [#](#property-requiresoriginaltiffcontainer)

[OfficeImageMetadata.cs:53](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L53)

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

`public byte[]? ExifProfile { get; set; }` [#](#property-exifprofile)

[OfficeImageMetadata.cs:56](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L56)

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

`public byte[]? XmpProfile { get; set; }` [#](#property-xmpprofile)

[OfficeImageMetadata.cs:60](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L60)

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

`public byte[]? IccProfile { get; set; }` [#](#property-iccprofile)

[OfficeImageMetadata.cs:64](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L64)

ICC profile bytes. Profile arrays are copied.

`public byte[]? IptcProfile { get; set; }` [#](#property-iptcprofile)

[OfficeImageMetadata.cs:66](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L66)

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

`public IReadOnlyList<OfficeExifValue> ExifValues { get; }` [#](#property-exifvalues)

[OfficeImageMetadata.cs:71](https://github.com/EvotecIT/OfficeIMO/blob/7fbbd72e7c5a401b9579a484b97ed0a9a426ce11/OfficeIMO.Core/Raster/OfficeImageMetadata.cs#L71)

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

<!-- PowerForge markdown artifact sha256:3EF004F1FAEB9F9BF517E5D0F9217513FDEEBCE9EA88A8F4725BA5862D56BE39 -->
