Click or drag to resize

TiffDirectoryTags Property

Gets the collection of TiffTag objects associated with the image.

Namespace:  Atalasoft.Imaging.Codec.Tiff
Assembly:  Atalasoft.dotImage (in Atalasoft.dotImage.dll) Version: 11.0.0.0.0.297 (.NET 4.5.2, x86)
Syntax
public TiffTagCollection Tags { get; }

Property Value

Type: TiffTagCollection
A TiffTagCollection representing all TIFF Tags in the image.
Exceptions
ExceptionCondition
Thrown when the TiffFile's stream is closed when accessing a tag that is originally loaded as a data pointer. This usually is the case for string and binary data.
Remarks

WARNING!!!

TIFF Tags can be edited, added, and removed using this collection property. However the developer is expected to have full understanding of the TIFF specification. Editing tags in ways that are not supported by the TIFF specification can create a corrupt file.

For example, changing the ImageWidth, ImageHeight, Compression, Photometric, and others to an unexpected value will result in a corrupt TIFF file.

When reading TIFF Tags, the TiffFile stream must remain open to read some tags that are populated only when accessing the Data property.

Examples

Displays all TIFF Tags from a TIFF document.

GetAllTagsCS (C#)
TiffFile file = new TiffFile();
using (Stream fs1 = new FileStream("file1.tif", FileMode.Open, FileAccess.Read, FileShare.Read))
{
        file.Read(fs1);
        foreach (TiffDirectory image in file.Images)
        {
                foreach (TiffTag tag in image.Tags)
                {
                        Console.WriteLine(tag.ToString());
                }
        }
}
GetAllTagsVB (Visual Basic)
Dim file As TiffFile = New TiffFile()
Dim fs1 As Stream = New FileStream("file1.tif", FileMode.Open, FileAccess.Read, FileShare.Read)
Try
        file.Read(fs1)
        ForEach image As TiffDirectory In file.Images
                ForEach tag As TiffTag In image.Tags
                        Console.WriteLine(tag.ToString())
                Next
        Next
Finally
    fs1.Close()
End Try

Adds a new ImageDescription tag to a TIFF File.

AddNewTagCS (C#)
TiffFile file = new TiffFile("multi.tif");
file.Images[0].Tags.Add(
            new TiffTag(TiffTagID.ImageDescription, 
            "Created with the DotImage Example Code", 
            TiffTagDataType.Ascii));
file.Save("multi_newtag.tif");
AddNewTagVB (Visual Basic)
Dim file As TiffFile = New TiffFile("multi.tif") 
file.Images(0).Tags.Add( _
            New TiffTag(TiffTagID.ImageDescription, _
            "Created with the DotImage Example Code", _ 
            TiffTagDataType.Ascii))
file.Save("multi_newtag.tif")
See Also