IptcDictionary Class

Represents a dictionary of IPTC entries.

Definition

Namespace: GleamTech.ImageUltimate
Assembly: GleamTech.ImageUltimate (in GleamTech.ImageUltimate.dll) Version: 5.8.8
C#
public sealed class IptcDictionary : IMetadataDictionary<IptcTag, IptcEntry>, 
	IEnumerable<IptcEntry>, IEnumerable
Inheritance
Object    IptcDictionary
Implements
IMetadataDictionaryIptcTag, IptcEntry, IEnumerableIptcEntry, IEnumerable

Example

C#
//Load image info of "c:\SomeFolder\InputFile.png"
using (var imageInfo = new ImageInfo(@"c:\SomeFolder\InputFile.png"))
{
}

//---------------------------------------

//Load with a virtual path string:
//See below for other path string examples.
using (var imageInfo = new ImageInfo("~/SomeFolder/InputFile.png"))
{
}

//Load with a URL string:
//See below for other path string examples.
using (var imageInfo = new ImageInfo("http://example.com/SomeFolder/InputFile.png"))
{
}

//Load with a Data URL string:
//See below for other path string examples.
using (var imageInfo = new ImageInfo("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"))
{
}

//Load with a file provider instance:
//See below for other file provider examples (UNC Path, AmazonS3, AzureBlob, Database etc.).
var fileProvider = new FileSystemFileProvider
{
    File = "InputFile.png",
    Location = new PhysicalLocation
    {
        Path = @"c:\SomeFolder"
    }
};
using (var imageInfo = new ImageInfo(fileProvider))
{
}

//Load with a provider string:
//See below for other provider string examples (UNC Path, AmazonS3, AzureBlob, Database etc.).
using (var imageInfo = new ImageInfo(@"Type=FileSystem; File=InputFile.png; Location='Type=Physical; Path=c:\SomeFolder'"))
{
}

C#
//Show info for a specific EXIF tag:
using (var imageInfo = new ImageInfo(@"C:\Input\Picture1.jpg"))
{
    var entry = imageInfo.ExifDictionary[ExifTag.Image.Artist];
    Console.WriteLine("Tag: " + entry.Tag);
    Console.WriteLine("Value: " + entry.Value);
    Console.WriteLine("Description: " + entry.Tag.Description);
    Console.WriteLine();

    if (imageInfo.ExifDictionary.TryGet(ExifTag.Image.Software, out ExifEntry entry2))
    {
        Console.WriteLine("Tag: " + entry2.Tag);
        Console.WriteLine("Value: " + entry2.Value);
        Console.WriteLine("Description: " + entry2.Tag.Description);
        Console.WriteLine();
    }
}

//Show info for a specific IPTC tag:
using (var imageInfo = new ImageInfo(@"C:\Input\Picture1.jpg"))
{
    var entry = imageInfo.IptcDictionary[IptcTag.Application2.Byline];
    Console.WriteLine("Tag: " + entry.Tag);
    Console.WriteLine("Value: " + entry.Value);
    Console.WriteLine("Description: " + entry.Tag.Description);
    Console.WriteLine();

    if (imageInfo.IptcDictionary.TryGet(IptcTag.Application2.ObjectName, out IptcEntry entry2))
    {
        Console.WriteLine("Tag: " + entry2.Tag);
        Console.WriteLine("Value: " + entry2.Value);
        Console.WriteLine("Description: " + entry2.Tag.Description);
        Console.WriteLine();
    }

    if (imageInfo.IptcDictionary.TryGet(IptcTag.Application2.Category, out IptcEntry[] entries))
    {
        foreach (var entry3 in entries)
        {
            Console.WriteLine("Tag: " + entry3.Tag);
            Console.WriteLine("Value: " + entry3.Value);
            Console.WriteLine("Description: " + entry3.Tag.Description);
            Console.WriteLine();
        }
    }
}

C#
//Modifying EXIF metadata:
using (var imageTask = new ImageTask(@"C:\Input\Picture1.jpg"))
{
    imageTask.Info.ExifDictionary.Remove(ExifTag.Image.Software);
    imageTask.Info.ExifDictionary.Set(ExifTag.Image.Artist, "UPDATED Artist TAG");

    imageTask.Info.IptcDictionary.Remove(IptcTag.Application2.Byline);
    imageTask.Info.IptcDictionary.Set(IptcTag.Application2.ObjectName, "UPDATED ObjectName TAG");

    imageTask.Save(@"C:\Output\Picture2.jpg");
}

Constructors

IptcDictionary Initializes a new instance of the IptcDictionary class.

Properties

CountGets the number of entries contained in this dictionary.
IsChangedGets a value indicating whether this dictionary is changed.
ItemGets the first occurrence of the entry for the specified tag.

Methods

ClearRemoves all entries from this dictionary.
ContainsDetermines whether this dictionary contains an entry with the specified tag.
GetEnumerator Returns an enumerator that iterates through this dictionary.
Remove(IptcTag)Removes all entries for the specified tag from this dictionary.
Remove(IptcTag, String)Removes the entry for the specified tag and value from this dictionary.
SetSets the value for the specified tag in this dictionary.
TryGet(IptcTag, IptcEntry)Gets the first occurrence of the entry associated with the specified tag.
TryGet(IptcTag, IptcEntry)Gets all entries associated with the specified tag.

See Also