Class Image
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
_fileIdlongThe persistent file identifier.
_fileNamestringThe full file name.
_processingInfosProcessingInfosThe completed processing operations.
_widthintThe image width in pixels.
_heightintThe image height in pixels.
_orientationOrientationModeThe stored image orientation.
_dateTakenDateTimeOffsetThe date and time the image was taken.
_titlestringThe image title.
_locationLocationThe optional image location.
_personsTagsIReadOnlyList<PersonTag>The associated person tags.
_tagsIReadOnlyList<string>The associated text tags.
Properties
DateTaken
Gets the date taken, trimmed to whole seconds.
public DateTimeOffset DateTaken { get; }
Property Value
FileName
Gets the full file name.
public string FileName { get; }
Property Value
Height
Gets the image height in pixels.
public int Height { get; }
Property Value
Id
Gets the persistent file identifier.
public long Id { get; }
Property Value
InvalidDateTaken
Gets the sentinel value representing an unset date taken.
public static DateTimeOffset InvalidDateTaken { get; }
Property Value
IsDateTimeSet
Gets whether a date taken has been set.
public bool IsDateTimeSet { get; }
Property Value
Location
Gets the optional image location.
public Location Location { get; }
Property Value
Name
Gets the final component of the Windows-style file name.
public string Name { get; }
Property Value
NumTags
Gets the number of text tags.
public int NumTags { get; }
Property Value
Orientation
Gets the stored image orientation.
public OrientationMode Orientation { get; }
Property Value
PersonTags
Gets the associated person tags.
public IReadOnlyList<PersonTag> PersonTags { get; }
Property Value
ProcessingInfos
Gets the completed processing operations.
public ProcessingInfos ProcessingInfos { get; }
Property Value
Tags
Gets the associated text tags.
public IReadOnlyList<string> Tags { get; }
Property Value
Title
Gets the image title, or an empty string when undefined.
public string Title { get; }
Property Value
Width
Gets the image width in pixels.
public int Width { get; }
Property Value
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
Returns
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
Returns
ChangeDateTaken(Image, DateTimeOffset)
Returns a copy with a different date taken.
public static Image ChangeDateTaken(Image image, DateTimeOffset dateTaken)
Parameters
imageImagedateTakenDateTimeOffset
Returns
ChangeFileName(Image, string)
Returns a copy with a different file name.
public static Image ChangeFileName(Image image, string fileName)
Parameters
Returns
ChangeLocation(Image, Location)
Returns a copy with a different location.
public static Image ChangeLocation(Image image, Location location)
Parameters
Returns
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
Returns
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
imageImageptPersonTagqualityFaceQuality
Returns
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
Returns
ChangePersonTags(Image, IEnumerable<PersonTag>)
Returns a copy with the supplied person tags.
public static Image ChangePersonTags(Image image, IEnumerable<PersonTag> personTags)
Parameters
imageImagepersonTagsIEnumerable<PersonTag>
Returns
ChangeProcessingInfo(Image, ProcessingInfos)
Returns a copy with different processing information.
public static Image ChangeProcessingInfo(Image image, ProcessingInfos processingInfos)
Parameters
imageImageprocessingInfosProcessingInfos
Returns
ChangeTags(Image, IEnumerable<string>)
Returns a copy with the supplied text tags.
public static Image ChangeTags(Image image, IEnumerable<string> tagsIn)
Parameters
imageImagetagsInIEnumerable<string>
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current object.
Returns
Equals(Image)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Image other)
Parameters
otherImageAn object to compare with this object.
Returns
FromJsonString(string)
Deserializes image metadata from JSON.
public static Image FromJsonString(string jsonString)
Parameters
jsonStringstring
Returns
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
namestring
Returns
HasPerson(string)
Determines whether the image has a person with the specified name.
public bool HasPerson(string name)
Parameters
namestring
Returns
HasPersonTag(PersonTag)
Determines whether the image contains an equal person tag.
public bool HasPersonTag(PersonTag personTag)
Parameters
personTagPersonTag
Returns
HasTag(string)
Determines whether the image contains the specified text tag.
public bool HasTag(string t)
Parameters
tstring
Returns
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
Returns
RemovePersonWithName(Image, string)
Returns a copy without the person having the specified name.
public static Image RemovePersonWithName(Image image, string name)
Parameters
Returns
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
Returns
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.