VintaSoft Imaging .NET SDK 15.1: Документация для .NET разработчика
Vintasoft.Imaging.Codecs.ImageFiles.Tiff Namespace / TiffTagCollection Class
Класс TiffTagCollection
В этом разделе
Представляет коллекцию тегов файла TIFF.
Объектная модель
TiffTag TiffTagCollection
Синтаксис
'Declaration

<DefaultMemberAttribute("Item")>
Public NotInheritable Class TiffTagCollection

[DefaultMember("Item")]
public sealed class TiffTagCollection

Ремарки

Экземпляр этого класса не может быть создан напрямую, его можно получить только из объекта TiffPage.

Эта коллекция позволяет читать/записывать/удалять теги.

Тег с идентификатором из перечисления ReadOnlyTiffTagId не может быть добавлен/изменен/удален.

Пример

Вот пример, показывающий, как добавлять, обновлять и удалять теги файла TIFF:


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();
    }
}

Иерархия наследования

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

Требования

Целевые платформы: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

Смотрите также