ImageTextEntry Class

An immutable textual metadata entry (PNG tEXt/zTXt/iTXt chunk, GIF comment extension, JPEG COM segment).

public sealed class ImageTextEntry : IEquatable<ImageTextEntry>

Remarks

Whether an entry is representable depends on the output format (for example PNG keywords are limited to 1 to 79 Latin-1 characters, and GIF/JPEG only store comments). Entries are validated when they are serialized; unsupported entries follow the encoder's MetadataHandling policy. The compression of PNG text chunks is an encoding detail chosen by the encoder.

Implements

Constructors

NameDescription
ImageTextEntry(string, string, string?, string?)Initializes a new instance of the ImageTextEntry class.

ImageTextEntry(string, string, string?, string?)

ImageTextEntry.cs

Initializes a new instance of the ImageTextEntry class.

public ImageTextEntry(string keyword, string value, string? languageTag = null, string? translatedKeyword = null)

Parameters

keyword string
The keyword (for example "Title", "Author" or ImageTextEntry.CommentKeyword).
value string
The text.
languageTag string?
The optional RFC 5646 language tag of value.
translatedKeyword string?
The optional translation of keyword into languageTag.

Exceptions

ArgumentException
keyword is empty.
ArgumentNullException
keyword or value is null.

Properties

NameDescription
KeywordGets the keyword.
LanguageTagGets the RFC 5646 language tag of ImageTextEntry.Value, if any.
TranslatedKeywordGets the translated keyword, if any.
ValueGets the text.

Gets the keyword.

public string Keyword { get; }

Property value

string

Gets the RFC 5646 language tag of ImageTextEntry.Value, if any.

public string? LanguageTag { get; }

Property value

string?

TranslatedKeyword

ImageTextEntry.cs

Gets the translated keyword, if any.

public string? TranslatedKeyword { get; }

Property value

string?

Gets the text.

public string Value { get; }

Property value

string

Methods

NameDescription
Equals(ImageTextEntry?)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Determines whether the specified object is equal to the current object.
GetHashCode()Serves as the default hash function.
ToString()Returns a string that represents the current object.

Equals overloads

Equals(ImageTextEntry?)

ImageTextEntry.cs

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ImageTextEntry? other)
Parameters
other ImageTextEntry?
An object to compare with this object.
Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

ImageTextEntry.cs

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current object.
Returns

bool true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

ImageTextEntry.cs

Serves as the default hash function.

public override int GetHashCode()

Returns

int A hash code for the current object.

Returns a string that represents the current object.

public override string ToString()

Returns

string A string that represents the current object.

Constants

NameDescription
CommentKeywordThe keyword used for comments (GIF comment extensions, JPEG COM segments, PNG "Comment" keyword).

CommentKeyword

The keyword used for comments (GIF comment extensions, JPEG COM segments, PNG "Comment" keyword).

public const string CommentKeyword = "Comment"