はじめに

環境

1
2
3
Windows 10 Professional
WSL2 (Ubuntu 22.04LTS)
exiftool 12.40

Exifとは?

Exchangeable image file format(エクスチェンジャブル・イメージ・ファイル・フォーマット)は、富士フイルムが開発し、当時の日本電子工業振興協会 (JEIDA)で規格化された、写真用のメタデータを含む画像ファイルフォーマット。デジタルカメラの画像の保存に使われる。略称はExifで「エグジフ」(もしくは「イグジフ」)。 カメラの機種や撮影時の条件情報を画像に埋め込んでいて、ビューワや写真編集ソフトなどで参照、応用することができる。Exif2.2ではExif Printという規格を組み込んでおり、撮影時の条件情報を元に自動的に最適化を行って、的確な状態でプリント出力を可能にしている。また撮影者や著作権情報、コメントなど付随することが出来る。
引用: https://ja.wikipedia.org/wiki/Exchangeable_image_file_format

普段使用している iphone などの画像にはExif情報がついており、撮影した場所などの情報も見れたりする。
豆知識だが、twitterなどのSNSサービスでは基本的にアップロードした画像のExif情報は消されるようになっている。

exiftoolのインストール

1
$ sudo apt-get install exiftool
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libimage-exiftool-perl' instead of 'exiftool'
The following additional packages will be installed:
  libarchive-zip-perl libmime-charset-perl libsombok3 libunicode-linebreak-perl
Suggested packages:
  libposix-strptime-perl libencode-hanextra-perl libpod2-base-perl
The following NEW packages will be installed:
  libarchive-zip-perl libimage-exiftool-perl libmime-charset-perl libsombok3 libunicode-linebreak-perl
0 upgraded, 5 newly installed, 0 to remove and 15 not upgraded.
Need to get 3964 kB of archives.
After this operation, 23.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 libarchive-zip-perl all 1.68-1 [90.2 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libimage-exiftool-perl all 12.40+dfsg-1 [3717 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libmime-charset-perl all 1.012.2-1 [30.9 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libsombok3 amd64 2.4.0-2 [26.9 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libunicode-linebreak-perl amd64 0.0.20190101-1build3 [99.1 kB]
Fetched 3964 kB in 3s (1318 kB/s)
Selecting previously unselected package libarchive-zip-perl.
(Reading database ... 51893 files and directories currently installed.)
Preparing to unpack .../libarchive-zip-perl_1.68-1_all.deb ...
Unpacking libarchive-zip-perl (1.68-1) ...
Selecting previously unselected package libimage-exiftool-perl.
Preparing to unpack .../libimage-exiftool-perl_12.40+dfsg-1_all.deb ...
Unpacking libimage-exiftool-perl (12.40+dfsg-1) ...
Selecting previously unselected package libmime-charset-perl.
Preparing to unpack .../libmime-charset-perl_1.012.2-1_all.deb ...
Unpacking libmime-charset-perl (1.012.2-1) ...
Selecting previously unselected package libsombok3:amd64.
Preparing to unpack .../libsombok3_2.4.0-2_amd64.deb ...
Unpacking libsombok3:amd64 (2.4.0-2) ...
Selecting previously unselected package libunicode-linebreak-perl.
Preparing to unpack .../libunicode-linebreak-perl_0.0.20190101-1build3_amd64.deb ...
Unpacking libunicode-linebreak-perl (0.0.20190101-1build3) ...
Setting up libsombok3:amd64 (2.4.0-2) ...
Setting up libarchive-zip-perl (1.68-1) ...
Setting up libimage-exiftool-perl (12.40+dfsg-1) ...
Setting up libmime-charset-perl (1.012.2-1) ...
Setting up libunicode-linebreak-perl (0.0.20190101-1build3) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
/sbin/ldconfig.real: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link

インストール完了

exiftoolを使用して画像を解析する。

1
exiftool [ファイル名]

でできるとのこと、早速この前撮った写真をかけてみる。

1
exiftool IMG_4010.jpeg
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
ExifTool Version Number         : 12.40
File Name                       : IMG_4010.jpeg
Directory                       : .
File Size                       : 1934 KiB
File Modification Date/Time     : 2023:04:01 20:12:10+09:00
File Access Date/Time           : 2023:04:02 19:12:50+09:00
File Inode Change Date/Time     : 2023:04:02 19:12:50+09:00
File Permissions                : -rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Exif Byte Order                 : Big-endian (Motorola, MM)
Make                            : Apple
Camera Model Name               : iPhone 12 mini
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : 16.3.1
Modify Date                     : 2023:03:31 08:51:39
Host Computer                   : iPhone 12 mini
Tile Width                      : 512
Tile Length                     : 512
Y Cb Cr Positioning             : Centered
Exposure Time                   : 1/4132
F Number                        : 1.6
Exposure Program                : Program AE
ISO                             : 32
Exif Version                    : 0232
Date/Time Original              : 2023:03:31 08:51:39
Create Date                     : 2023:03:31 08:51:39
Offset Time                     : +09:00
Offset Time Original            : +09:00
Offset Time Digitized           : +09:00
Components Configuration        : Y, Cb, Cr, -
Shutter Speed Value             : 1/4132
Aperture Value                  : 1.6
Brightness Value                : 10.06886455
Exposure Compensation           : 0
Metering Mode                   : Multi-segment
Flash                           : Off, Did not fire
Focal Length                    : 4.2 mm
Subject Area                    : 2009 1502 2208 1387
Run Time Flags                  : Valid
Run Time Value                  : 675514395490500
Run Time Scale                  : 1000000000
Run Time Epoch                  : 0
Acceleration Vector             : -0.9771665344 -0.03010103665 0.2078183441
Warning                         : [minor] Bad format (16) for MakerNotes entry 13
Sub Sec Time Original           : 380
Sub Sec Time Digitized          : 380
Flashpix Version                : 0100
Color Space                     : Uncalibrated
Exif Image Width                : 4032
Exif Image Height               : 3024
Sensing Method                  : One-chip color area
Scene Type                      : Directly photographed
Exposure Mode                   : Auto
White Balance                   : Auto
Focal Length In 35mm Format     : 26 mm
Scene Capture Type              : Standard
Lens Info                       : 1.549999952-4.2mm f/1.6-2.4
Lens Make                       : Apple
Lens Model                      : iPhone 12 mini back dual wide camera 4.2mm f/1.6
Composite Image                 : General Composite Image
GPS Latitude Ref                : North
GPS Longitude Ref               : East
GPS Altitude Ref                : Above Sea Level
GPS Speed Ref                   : km/h
GPS Speed                       : 0.32
GPS Img Direction Ref           : True North
GPS Img Direction               : 23.35421752
GPS Dest Bearing Ref            : True North
GPS Dest Bearing                : 23.35421752
GPS Horizontal Positioning Error: 16.11236185 m
MPF Version                     : 0100
Number Of Images                : 2
MP Image Flags                  : (none)
MP Image Format                 : JPEG
MP Image Type                   : Undefined
MP Image Length                 : 209853
MP Image Start                  : 1770513
Dependent Image 1 Entry Number  : 0
Dependent Image 2 Entry Number  : 0
Profile CMM Type                : Apple Computer Inc.
Profile Version                 : 4.0.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 2022:01:01 00:00:00
Profile File Signature          : acsp
Primary Platform                : Apple Computer Inc.
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : Apple Computer Inc.
Device Model                    :
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : Apple Computer Inc.
Profile ID                      : ecfda38e388547c36db4bd4f7ada182f
Profile Description             : Display P3
Profile Copyright               : Copyright Apple Inc., 2022
Media White Point               : 0.96419 1 0.82489
Red Matrix Column               : 0.51512 0.2412 -0.00105
Green Matrix Column             : 0.29198 0.69225 0.04189
Blue Matrix Column              : 0.1571 0.06657 0.78407
Red Tone Reproduction Curve     : (Binary data 32 bytes, use -b option to extract)
Chromatic Adaptation            : 1.04788 0.02292 -0.0502 0.02959 0.99048 -0.01706 -0.00923 0.01508 0.75168
Blue Tone Reproduction Curve    : (Binary data 32 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 32 bytes, use -b option to extract)
Image Width                     : 2048
Image Height                    : 1536
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Run Time Since Power Up         : 7 days 19:38:34
Aperture                        : 1.6
Image Size                      : 2048x1536
Megapixels                      : 3.1
Scale Factor To 35 mm Equivalent: 6.2
Shutter Speed                   : 1/4132
Create Date                     : 2023:03:31 08:51:39.380+09:00
Date/Time Original              : 2023:03:31 08:51:39.380+09:00
Modify Date                     : 2023:03:31 08:51:39+09:00
GPS Altitude                    : 9.1 m Above Sea Level
GPS Latitude                    : 35 deg 41' 56.12" N
GPS Longitude                   : 139 deg 48' 55.22" E
MP Image 2                      : (Binary data 209853 bytes, use -b option to extract)
Circle Of Confusion             : 0.005 mm
Field Of View                   : 69.4 deg
Focal Length                    : 4.2 mm (35 mm equivalent: 26.0 mm)
GPS Position                    : 35 deg 41' 56.12" N, 139 deg 48' 55.22" E
Hyperfocal Distance             : 2.27 m
Light Value                     : 15.0
Lens ID                         : iPhone 12 mini back dual wide camera 4.2mm f/1.6

おぉ~できてる。 ちなみに GPS Latitude , GPS Longitude が緯度経度となっているようだ。
これをGoogleMapにいれると撮った場所がわかるので見てみよう。

1
2
3
4
5
35 deg 41' 56.12" N
139 deg 48' 55.22" E
なので、 度分秒(DMS)に直すと、
35 deg 41' 56.12" N → 35°41'56.12"N
139 deg 48' 55.22" E → 139°48'55.22"E

参考: https://support.google.com/maps/answer/18539?hl=ja&co=GENIE.Platform%3DDesktop

変換できたので、 35°41'56.12"N 139°48'55.22"E を GoogleMapに入れてみる。

pos-gmap おぉ~まさにここだ~。
ついでに今回使った画像も貼っておく。

IMG_4010
ストリートビューで見るとわかるが、まさにこんな感じになっている。

参考

おわりに

exiftool 以外にも identityfile などのコマンドでもできるとのことだが、今回はexiftool を使用した。
しっかりとしたSNSであれば、exif 情報は削除されているがそうでないサービスも当然有ることは頭に入れておきたい。
なので、exif 情報が削除されないサービスでは、住所まで特定される可能性があるので気をつけてアップロードしたほうが良さそうだ。