Класс TiffPageIfdMetadata
Узел метаданных, в котором хранится информация о корневом каталоге TIFF файлов изображений (IFD) страницы TIFF.
Вот C#/VB.NET код, который демонстрирует, как добавить или установить значение тега Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.Software.
''' <summary>
''' Adds or sets the <see cref="Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.Software"/> tag value
''' to the TIFF metadata tree.
''' </summary>
''' <param name="tiffImage">A TIFF image.</param>
''' <param name="softwareTagValue">A value of Software tag.</param>
''' <exception cref="System.ArgumentException">Thrown if image does not have TIFF metadata.</exception>
Public Sub AddSoftwareTiffTagToTiffMetadata(tiffImage As Vintasoft.Imaging.VintasoftImage, softwareTagValue As String)
' get TIFF metadata
Dim tiffPageMetadata As Vintasoft.Imaging.Metadata.TiffPageMetadata = TryCast(tiffImage.Metadata.MetadataTree, Vintasoft.Imaging.Metadata.TiffPageMetadata)
' if TIFF metadata exists
If tiffPageMetadata IsNot Nothing Then
' get ID of Software tag
Dim softwareTagId As Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId = Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.Software
' add the Software tag to TIFF metadata
tiffPageMetadata.IFD.SetTiffTagMetadata(CInt(softwareTagId), softwareTagValue)
Else
Throw New System.ArgumentException("The image does not have TIFF metadata.")
End If
End Sub
/// <summary>
/// Adds or sets the <see cref="Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.Software"/> tag value
/// to the TIFF metadata tree.
/// </summary>
/// <param name="tiffImage">A TIFF image.</param>
/// <param name="softwareTagValue">A value of Software tag.</param>
/// <exception cref="System.ArgumentException">Thrown if image does not have TIFF metadata.</exception>
public void AddSoftwareTiffTagToTiffMetadata(Vintasoft.Imaging.VintasoftImage tiffImage, string softwareTagValue)
{
// get TIFF metadata
Vintasoft.Imaging.Metadata.TiffPageMetadata tiffPageMetadata =
tiffImage.Metadata.MetadataTree as Vintasoft.Imaging.Metadata.TiffPageMetadata;
// if TIFF metadata exists
if (tiffPageMetadata != null)
{
// get ID of Software tag
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId softwareTagId =
Vintasoft.Imaging.Codecs.ImageFiles.Tiff.TiffTagId.Software;
// add the Software tag to TIFF metadata
tiffPageMetadata.IFD.SetTiffTagMetadata((int)softwareTagId, softwareTagValue);
}
else
throw new System.ArgumentException("The image does not have TIFF metadata.");
}
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5