VintaSoft Imaging .NET SDK v8.7
Vintasoft.Imaging.Codecs.ImageFiles.Tiff Namespace / TiffTagCollection Class
Members Example



In This Topic
    TiffTagCollection Class
    In This Topic
    Represents a tag collection of TIFF file.
    Object Model
    TiffTagCollection ClassTiffTag Class
    Syntax
    'Declaration
     
    <DefaultMemberAttribute("Item")>
    Public NotInheritable Class TiffTagCollection 
    [DefaultMember("Item")]
    public sealed class TiffTagCollection 
    [DefaultMember("Item")]
    public __gc __sealed class TiffTagCollection 
    [DefaultMember("Item")]
    public ref class TiffTagCollection sealed 
    Remarks
    Instance of this class cannot be created directly, it can be received only from the TiffPage object.

    This collection allows to read/write/remove tags.

    Tag with ID from the ReadOnlyTiffTagId enumeration cannot be added/modified/removed.
    Example
    This example shows how to add, update and remove tags of TIFF file.
    Class TiffTagCollectionExample
        Public Sub RunExample()
            ' [ do not forget to set your image file path here! ]
            ' open an existing image file
            Dim tiff As New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile("image-with-tags.tif")
                
            ' get the tags of the first page
            Dim tags As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection = tiff.Pages(0).IFD.Tags
                
            ' add several tags
            tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.Software, "VintaSoft Imaging .NET SDK v8.2")
            tags.Add(CUShort(&He001), "BarcodeInfo")
            tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.DateTime, "2010:10:10 10:20:05")
            tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.XResolution, New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffRational(100, 1))
            tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.YResolution, New Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffRational(100, 1))
            ' remove tag
            tags.Remove(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.PrintImageMatching)
                
            ' save changes
            tiff.SaveChanges()
        End Sub
    End Class
    class TiffTagCollectionExample
    {
        public void RunExample()
        {
            // [ do not forget to set your image file path here! ]
            // open an existing image file
            Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile tiff =
                new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffFile(@"image-with-tags.tif");
                
            // get the tags of the first page
            Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection tags = tiff.Pages[0].IFD.Tags;
                
            // add several tags
            tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.Software,
                "VintaSoft Imaging .NET SDK v8.2");
            tags.Add((ushort)0xE001, "BarcodeInfo");
            tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.DateTime, "2010:10:10 10:20:05");
            tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.XResolution,
                new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffRational(100, 1));
            tags.Add(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.YResolution,
                new Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffRational(100, 1));
            // remove tag
            tags.Remove(Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.PrintImageMatching);
                
            // save changes
            tiff.SaveChanges();
        }
    }
    Inheritance Hierarchy

    System.Object
       Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagCollection

    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also