VintaSoft Imaging .NET SDK and Plug-ins Discussions
Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.
Board index < VintaSoft Imaging < VintaSoft Imaging .NET SDK and Plug-ins Discussions
Imports System.IO
Imports Vintasoft.Imaging.Codecs.Tiff
Imports Vintasoft.Imaging.Codecs.Jpeg
Module Module1
Sub Main()
Using jpegStream As FileStream = New FileStream("..\..\053.jpg", FileMode.Open, FileAccess.Read)
Using jpeg As JpegFile = New JpegFile(jpegStream)
Dim exif As ExifData = jpeg.Page.Exif
If exif Is Nothing Then
Console.WriteLine("JPEG file does not have EXIF data.")
Else
WriteTagsData("EXIF", exif.ExifTags, GetType(ExifTagId))
WriteTagsData("GPS", exif.GpsTags, GetType(GpsTagId))
End If
End Using
End Using
Console.WriteLine("Press any key to continue...")
Console.ReadKey()
End Sub
Private Sub WriteTagsData(ByRef tagsName As String, ByRef tags As TiffTagCollection, ByRef tagIdEnumType As Type)
If tags.Count = 0 Then
Console.WriteLine(String.Format("No {0} data.", tagsName))
Else
Console.WriteLine(String.Format("{0} data [{1}]:", tagsName, tags.Count))
Dim tag As TiffTag
Dim tagData As Object
Dim tagDataAsArray As Array
Dim tagDataAsString As String
' for each tag in tag collection
For i = 0 To tags.Count - 1
' get tag
tag = tags(i)
' get tag data
tagData = tag.Data
' if tag data is array
If IsArray(tagData) Then
tagDataAsString = "[ "
tagDataAsArray = CType(tagData, Array)
For j = 0 To tagDataAsArray.Length - 1
tagDataAsString = tagDataAsString + tagDataAsArray(j).ToString + "; "
Next
tagDataAsString = tagDataAsString + "]"
' if tag data is NOT array
Else
tagDataAsString = tagData.ToString()
End If
' add information about tag to textbox
Console.WriteLine(String.Format("- Name={0}, Id={1}, Type={2}, Data={3}", tag.GetName(tagIdEnumType), tag.Id, tag.Type, tagDataAsString))
Next
End If
Console.WriteLine()
End Sub
End Module
Best regards, Alexander