GetTextualInformation() Метод (PngPage)
Возвращает текстовую информацию об этой странице.
Return Value
Текстовая информация этой страницы в виде словаря.
Вот пример, показывающий, как изменить дату создания PNG-файла:
''' <summary>
''' Sets the creation time of PNG file.
''' </summary>
''' <param name="filename">The filename.</param>
''' <param name="creationDate">The creation date of file.</param>
Public Shared Sub SetCreationTime(filename As String, creationDate As System.DateTime)
' open PNG file
Using pngFile As New Vintasoft.Imaging.Codecs.ImageFiles.Png.PngFile(filename)
Dim page As Vintasoft.Imaging.Codecs.ImageFiles.Png.PngPage = pngFile.Page
' get the textual information of image
Dim textualInformation As System.Collections.Generic.Dictionary(Of String, String) = page.GetTextualInformation()
' add the creation date to the textual information
textualInformation("Creation Time") = creationDate.ToString("yyyy:MM:dd hh:mm:ss", System.Globalization.CultureInfo.InvariantCulture)
' set textual information of image
page.SetTextualInformation(textualInformation)
' save changes in PNG file
pngFile.SaveChanges()
End Using
End Sub
/// <summary>
/// Sets the creation time of PNG file.
/// </summary>
/// <param name="filename">The filename.</param>
/// <param name="creationDate">The creation date of file.</param>
public static void SetCreationTime(string filename, System.DateTime creationDate)
{
// open PNG file
using (Vintasoft.Imaging.Codecs.ImageFiles.Png.PngFile pngFile =
new Vintasoft.Imaging.Codecs.ImageFiles.Png.PngFile(filename))
{
Vintasoft.Imaging.Codecs.ImageFiles.Png.PngPage page = pngFile.Page;
// get the textual information of image
System.Collections.Generic.Dictionary<string, string> textualInformation = page.GetTextualInformation();
// add the creation date to the textual information
textualInformation["Creation Time"] = creationDate.ToString("yyyy:MM:dd hh:mm:ss",
System.Globalization.CultureInfo.InvariantCulture);
// set textual information of image
page.SetTextualInformation(textualInformation);
// save changes in PNG file
pngFile.SaveChanges();
}
}
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5