Table of Contents

Class Image

Namespace
TCSystem.MetaData
Assembly
TCSystem.MetaData.dll

Represents the immutable metadata associated with an image file.

public sealed class Image : IEquatable<Image>
Inheritance
Image
Implements
Inherited Members
Extension Methods

Constructors

Image(long, string, ProcessingInfos, int, int, OrientationMode, DateTimeOffset, string, Location, IReadOnlyList<PersonTag>, IReadOnlyList<string>)

Represents the immutable metadata associated with an image file.

public Image(long _fileId, string _fileName, ProcessingInfos _processingInfos, int _width, int _height, OrientationMode _orientation, DateTimeOffset _dateTaken, string _title, Location _location, IReadOnlyList<PersonTag> _personsTags, IReadOnlyList<string> _tags)

Parameters

_fileId long

The persistent file identifier.

_fileName string

The full file name.

_processingInfos ProcessingInfos

The completed processing operations.

_width int

The image width in pixels.

_height int

The image height in pixels.

_orientation OrientationMode

The stored image orientation.

_dateTaken DateTimeOffset

The date and time the image was taken.

_title string

The image title.

_location Location

The optional image location.

_personsTags IReadOnlyList<PersonTag>

The associated person tags.

_tags IReadOnlyList<string>

The associated text tags.

Properties

DateTaken

Gets the date taken, trimmed to whole seconds.

public DateTimeOffset DateTaken { get; }

Property Value

DateTimeOffset

FileName

Gets the full file name.

public string FileName { get; }

Property Value

string

Height

Gets the image height in pixels.

public int Height { get; }

Property Value

int

Id

Gets the persistent file identifier.

public long Id { get; }

Property Value

long

InvalidDateTaken

Gets the sentinel value representing an unset date taken.

public static DateTimeOffset InvalidDateTaken { get; }

Property Value

DateTimeOffset

IsDateTimeSet

Gets whether a date taken has been set.

public bool IsDateTimeSet { get; }

Property Value

bool

Location

Gets the optional image location.

public Location Location { get; }

Property Value

Location

Name

Gets the final component of the Windows-style file name.

public string Name { get; }

Property Value

string

NumTags

Gets the number of text tags.

public int NumTags { get; }

Property Value

int

Orientation

Gets the stored image orientation.

public OrientationMode Orientation { get; }

Property Value

OrientationMode

PersonTags

Gets the associated person tags.

public IReadOnlyList<PersonTag> PersonTags { get; }

Property Value

IReadOnlyList<PersonTag>

ProcessingInfos

Gets the completed processing operations.

public ProcessingInfos ProcessingInfos { get; }

Property Value

ProcessingInfos

Tags

Gets the associated text tags.

public IReadOnlyList<string> Tags { get; }

Property Value

IReadOnlyList<string>

Title

Gets the image title, or an empty string when undefined.

public string Title { get; }

Property Value

string

Width

Gets the image width in pixels.

public int Width { get; }

Property Value

int

Methods

AddPersonTag(Image, PersonTag)

Returns a copy containing the person tag, unless a valid person with the same name already exists.

public static Image AddPersonTag(Image image, PersonTag pt)

Parameters

image Image
pt PersonTag

Returns

Image

AddTag(Image, string)

Returns a copy containing the non-empty text tag, or the original image if it already exists.

public static Image AddTag(Image image, string t)

Parameters

image Image
t string

Returns

Image

ChangeDateTaken(Image, DateTimeOffset)

Returns a copy with a different date taken.

public static Image ChangeDateTaken(Image image, DateTimeOffset dateTaken)

Parameters

image Image
dateTaken DateTimeOffset

Returns

Image

ChangeFileName(Image, string)

Returns a copy with a different file name.

public static Image ChangeFileName(Image image, string fileName)

Parameters

image Image
fileName string

Returns

Image

ChangeLocation(Image, Location)

Returns a copy with a different location.

public static Image ChangeLocation(Image image, Location location)

Parameters

image Image
location Location

Returns

Image

ChangePerson(Image, Person)

Returns a copy in which the person with the same name is replaced.

public static Image ChangePerson(Image image, Person person)

Parameters

image Image
person Person

Returns

Image

ChangePersonTagFaceQuality(Image, PersonTag, FaceQuality)

Returns a copy with a person tag's face quality changed.

public static Image ChangePersonTagFaceQuality(Image image, PersonTag pt, FaceQuality quality)

Parameters

image Image
pt PersonTag
quality FaceQuality

Returns

Image

ChangePersonTagVisible(Image, PersonTag, bool)

Returns a copy with a person tag's face visibility changed.

public static Image ChangePersonTagVisible(Image image, PersonTag pt, bool visible)

Parameters

image Image
pt PersonTag
visible bool

Returns

Image

ChangePersonTags(Image, IEnumerable<PersonTag>)

Returns a copy with the supplied person tags.

public static Image ChangePersonTags(Image image, IEnumerable<PersonTag> personTags)

Parameters

image Image
personTags IEnumerable<PersonTag>

Returns

Image

ChangeProcessingInfo(Image, ProcessingInfos)

Returns a copy with different processing information.

public static Image ChangeProcessingInfo(Image image, ProcessingInfos processingInfos)

Parameters

image Image
processingInfos ProcessingInfos

Returns

Image

ChangeTags(Image, IEnumerable<string>)

Returns a copy with the supplied text tags.

public static Image ChangeTags(Image image, IEnumerable<string> tagsIn)

Parameters

image Image
tagsIn IEnumerable<string>

Returns

Image

Equals(object)

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.

Equals(Image)

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

public bool Equals(Image other)

Parameters

other Image

An object to compare with this object.

Returns

bool

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

FromJsonString(string)

Deserializes image metadata from JSON.

public static Image FromJsonString(string jsonString)

Parameters

jsonString string

Returns

Image

The image metadata, or null for null or empty input.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetPersonTag(string)

Gets the first person tag with the specified name.

public PersonTag GetPersonTag(string name)

Parameters

name string

Returns

PersonTag

The matching tag, or null.

HasPerson(string)

Determines whether the image has a person with the specified name.

public bool HasPerson(string name)

Parameters

name string

Returns

bool

HasPersonTag(PersonTag)

Determines whether the image contains an equal person tag.

public bool HasPersonTag(PersonTag personTag)

Parameters

personTag PersonTag

Returns

bool

HasTag(string)

Determines whether the image contains the specified text tag.

public bool HasTag(string t)

Parameters

t string

Returns

bool

RemovePersonTag(Image, PersonTag)

Returns a copy without the person tag, or the original image when it is absent.

public static Image RemovePersonTag(Image image, PersonTag pt)

Parameters

image Image
pt PersonTag

Returns

Image

RemovePersonWithName(Image, string)

Returns a copy without the person having the specified name.

public static Image RemovePersonWithName(Image image, string name)

Parameters

image Image
name string

Returns

Image

RemoveTag(Image, string)

Returns a copy without the text tag, or the original image when it is absent.

public static Image RemoveTag(Image image, string t)

Parameters

image Image
t string

Returns

Image

ToJsonString()

Serializes the image metadata to compact JSON.

public string ToJsonString()

Returns

string

The serialized metadata.

ToString()

Serializes the image metadata to indented JSON.

public override string ToString()

Returns

string

The formatted JSON.