Package: exiv2
Version: 0.27.6-1

The time zone stored in the photo may be very different from the time zone on the machine which runs exiv2. Consider the following example:

$ exiv2 -T test.jpg
$ exiftool test.jpg
ExifTool Version Number         : 12.57
File Name                       : test.jpg
Directory                       : .
File Size                       : 496 kB
File Modification Date/Time     : 2019:12:07 16:09:14+01:00
File Access Date/Time           : 2023:08:27 21:06:46+02:00
File Inode Change Date/Time     : 2023:08:27 21:06:45+02:00
File Permissions                : -rw-------
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Big-endian (Motorola, MM)
Make                            : Apple
Camera Model Name               : iPhone SE
Orientation                     : Rotate 180
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : 13.2.3
Modify Date                     : 2019:12:07 16:09:14
Y Cb Cr Positioning             : Centered
Exposure Time                   : 1/109
F Number                        : 2.4
Exposure Program                : Program AE
ISO                             : 50
Exif Version                    : 0231
Date/Time Original              : 2019:12:07 16:09:14
Create Date                     : 2019:12:07 16:09:14
Offset Time                     : +10:00
Offset Time Original            : +10:00
Offset Time Digitized           : +10:00
Components Configuration        : Y, Cb, Cr, -
Shutter Speed Value             : 1/109
Aperture Value                  : 2.4
Brightness Value                : 6.134006728
Exposure Compensation           : 0
Metering Mode                   : Multi-segment
Flash                           : Auto, Did not fire
Focal Length                    : 2.1 mm
Maker Note Version              : 11
Run Time Flags                  : Valid
Run Time Value                  : 13593698360583
Run Time Scale                  : 1000000000
Run Time Epoch                  : 0
AE Stable                       : Yes
AE Target                       : 214
AE Average                      : 211
AF Stable                       : Yes
Acceleration Vector             : -0.9600369334 0.03025732003 -0.222530246
HDR Image Type                  : HDR Image
Image Unique ID                 : 06F21219-30C6-4DDC-AC64-E896F45FB857
Live Photo Video Index          : 0
Signal To Noise Ratio           : 0
Sub Sec Time Original           : 455
Sub Sec Time Digitized          : 455
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 1280
Exif Image Height               : 960
Sensing Method                  : One-chip color area
Scene Type                      : Directly photographed
Custom Rendered                 : HDR (original saved)
Exposure Mode                   : Auto
White Balance                   : Auto
Focal Length In 35mm Format     : 31 mm
Scene Capture Type              : Standard
Lens Info                       : 2.15mm f/2.4
Lens Make                       : Apple
Lens Model                      : iPhone SE front camera 2.15mm f/2.4
Compression                     : JPEG (old-style)
Thumbnail Offset                : 1418
Thumbnail Length                : 12873
XMP Toolkit                     : XMP Core 5.4.0
Region Area Y                   : 0.64200000000000002
Region Area W                   : 0.28499999999999998
Region Area X                   : 0.19749999999999998
Region Area H                   : 0.38000000000000006
Region Area Unit                : normalized
Region Type                     : Face
Region Extensions Angle Info Yaw: 0
Region Extensions Angle Info Roll: 150
Region Extensions Confidence Level: 1000
Region Extensions Time Stamp    : 326245557611
Region Extensions Face ID       : 12
Region Applied To Dimensions H  : 960
Region Applied To Dimensions W  : 1280
Region Applied To Dimensions Unit: pixel
Image Width                     : 1280
Image Height                    : 960
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         : 3:46:34
Aperture                        : 2.4
Image Size                      : 1280x960
Megapixels                      : 1.2
Scale Factor To 35 mm Equivalent: 14.4
Shutter Speed                   : 1/109
Create Date                     : 2019:12:07 16:09:14.455+10:00
Date/Time Original              : 2019:12:07 16:09:14.455+10:00
Modify Date                     : 2019:12:07 16:09:14+10:00
Thumbnail Image : (Binary data 12873 bytes, use -b option to extract)
Circle Of Confusion             : 0.002 mm
Field Of View                   : 60.3 deg
Focal Length                    : 2.1 mm (35 mm equivalent: 31.0 mm)
Hyperfocal Distance             : 0.92 m
Light Value                     : 10.3
Lens ID                         : iPhone SE front camera 2.15mm f/2.4
$ la -la --full-time test.jpg | cut -d ' ' -f 6-
2019-12-07 16:09:14.000000000 +0100 test.jpg

The file-modification date has been wrongly set to “2019-12-07 16:09:14.000000000 +0100” (because exiv2 has been run somewhere in Europe), whereas the correct date should have been “2019-12-07 16:09:14.455000000 +1000” (because the photo was shot somewhere in Australia) or, equivalently, “2019-12-07 07:09:14.455000000 +0100” (because the machine is somewhere in Europe). This behavior of `exiv2 -T` makes no sense whatsoever. (Of course the manpages speak about $TZ, but this way would be far from automatic: it would involve first reading out the time zone from the JPEG file via, say, exiftool, then magically getting to know the descriptor of the time zone where the photo was shot, and finally running something like `TZ=Australia/Queensland exiv2 -T test.jpg`, whereas instead of the last two steps we could have already simply said `touch -d "2019-12-07 16:09:14.455 +1000" test.jpg`.)

Instead of this nonsensical and confusing behavior of `-T`, this option needs to be removed altogether in favor of a better one, or the functionality of `-T` has to be altered: it should take into account the time zone stored in the JPEG file whenever available. Moreover, notice that the subseconds (in our example, `.455`) should be taken into account, too, whenever available.

Gratefully,
AlMa

Reply via email to