Exel VBA 画像ファイルのプロパティで確認できるExif情報の抽出
Excelで画像ファイルのExif情報を抽出する方法
WEBサイトからの記事です。
———————————————————–
'変数の宣言を必須
Option Explicit
Sub sample()
Dim photFile As String
Dim objWia As Object
Dim p As Object
Dim makerName As String
Dim ModelName As String
Dim dateOfShooting As String
Dim latitude As String
Dim longitude As String
'対象の写真(画像ファイル)を指定
photFile = "C:\Users\user\Desktop\IMG_0264-225x300.jpeg"
Set objWia = CreateObject("Wia.ImageFile")
'写真(画像ファイル)をロード
objWia.LoadFile photFile
For Each p In objWia.Properties
Select Case p.Name
'カメラの製造元
Case "EquipMake"
makerName = p.Value
'カメラのモデル
Case "EquipModel"
ModelName = p.Value
'撮影日時
Case "ExifDTOrig"
dateOfShooting = p.Value
'緯度
Case "GpsLatitude"
latitude = p.Value(1) + p.Value(2) / 60 + p.Value(3) / 3600
'経度
Case "GpsLongitude"
longitude = p.Value(1) + p.Value(2) / 60 + p.Value(3) / 3600
End Select
Next
'イミディエイトウィンドウへ出力
Debug.Print "カメラの製造元:" & makerName
Debug.Print "カメラのモデル:" & ModelName
Debug.Print "撮影日時 :" & dateOfShooting
Debug.Print "緯度 :" & latitude
Debug.Print "経度 :" & longitude
'後片付け
Set objWia = Nothing
End Sub
———————————————————–

















ディスカッション
コメント一覧
まだ、コメントがありません