读取图片里的Exif信息,尤其是单反的原图
代码:
Dim img As Image = Image.FromFile("D:\IMG_20200522_155639.jpg") Dim pt As PropertyItem() = img.PropertyItems For i As Integer = 0 To pt.Length - 1 Dim p As PropertyItem = pt(i) Select Case pt(i).Id Case &H132 Dim s As String = System.Text.Encoding.ASCII.GetString(p.value) Output.Show("修改时间: " & s & vbcrlf) Case &H9003 Dim s As String = System.Text.Encoding.ASCII.GetString(p.value) Output.Show("拍摄时间: " & s & vbcrlf) Case &H110 Dim s As String = System.Text.Encoding.ASCII.GetString(p.value) Output.Show("相机型号: " & s & vbcrlf) Case &H10F Dim s As String = System.Text.Encoding.ASCII.GetString(p.value) Output.Show("制造商: " & s & vbcrlf) Case &H131 Dim s As String = System.Text.Encoding.ASCII.GetString(p.value) Output.Show("修改软件: " & s & vbcrlf) End Select Next Output.Show("图像高度: " & img.Height & "px" ) Output.Show("图像宽度: " & img.Width & "px" )
Exif相关参考链接:http://blog.sina.com.cn/s/blog_651251e60102uz3d.html#ExifMarker