immich icon indicating copy to clipboard operation
immich copied to clipboard

[BUG] Missing timezone for some photos

Open uhthomas opened this issue 2 years ago • 1 comments

The bug

A user in Discord has found the attached image to show no time zone when uploaded with Immich. A quick inspection with exiftool reveals:

ExifTool Version Number         : 12.60
File Name                       : image00001.jpeg
Directory                       : .
File Size                       : 14 kB
File Modification Date/Time     : 2023:06:25 17:16:13+01:00
File Access Date/Time           : 2023:06:25 17:16:13+01:00
File Inode Change Date/Time     : 2023:06:25 17:16:15+01: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)
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Modify Date                     : 2023:06:24 19:27:33
Exif Version                    : 0221
Date/Time Original              : 2023:06:24 19:27:33
Create Date                     : 2023:06:24 19:27:33
Offset Time                     : +05:30
Offset Time Original            : +05:30
Offset Time Digitized           : +05:30
Components Configuration        : Y, Cb, Cr, -
Sub Sec Time                    : 000
Sub Sec Time Original           : 000
Sub Sec Time Digitized          : 000
Flashpix Version                : 0100
Color Space                     : Uncalibrated
Exif Image Width                : 135
Exif Image Height               : 574
Scene Capture Type              : Standard
GPS Latitude Ref                : North
GPS Longitude Ref               : East
GPS Time Stamp                  : 05:27:30
GPS Date Stamp                  : 2023:06:25
GPS Horizontal Positioning Error: 1 m
Current IPTC Digest             : 271cf5277073fe39030fc3e607e77e93
Coded Character Set             : UTF8
Application Record Version      : 2
Digital Creation Time           : 19:27:33
Digital Creation Date           : 2023:06:24
Date Created                    : 2023:06:24
Time Created                    : 19:27:33+05:30
IPTC Digest                     : 271cf5277073fe39030fc3e607e77e93
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                     : 135
Image Height                    : 574
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 135x574
Megapixels                      : 0.077
Create Date                     : 2023:06:24 19:27:33.000+05:30
Date/Time Original              : 2023:06:24 19:27:33.000+05:30
Modify Date                     : 2023:06:24 19:27:33.000+05:30
GPS Date/Time                   : 2023:06:25 05:27:30Z
GPS Latitude                    : 23 deg 0' 54.77" N
GPS Longitude                   : 72 deg 35' 33.51" E
Date/Time Created               : 2023:06:24 19:27:33+05:30
Digital Creation Date/Time      : 2023:06:24 19:27:33
GPS Position                    : 23 deg 0' 54.77" N, 72 deg 35' 33.51" E

Note, there are two entries for the Create Date tag. The first one has no timezone, whereas the second one does have a timezone. We should explore whether #2908 resolves this and investigate further as to why this happens and how we can prevent it from happening in future.

image00001

The OS that Immich Server is running on

N/A

Version of Immich Server

v1.63.2

Version of Immich Mobile App

N/A

Platform with the issue

  • [X] Server
  • [ ] Web
  • [ ] Mobile

Your docker-compose.yml content

N/A

Your .env content

N/A

Reproduction steps

N/A

Additional information

No response

uhthomas avatar Jun 25 '23 21:06 uhthomas

FWIW this is resolved by #2908.

image

uhthomas avatar Jun 30 '23 00:06 uhthomas

I am commenting because this issue is still open and I have a similar problem. I am located in GMT+2 and have a combination of images from both my phone and a DSLR. The phone images are represented accurately in local time whereas the DSLR photos are two hours ahead from the moment they were captured. Exif on one of the DSLR images is as follows:

ExifTool Version Number         : 12.60
File Name                       : 20230814.1431 — RICOH GR III-Enhanced-RD.TIF
Directory                       : /Users/duffy/Documents
File Size                       : 144 MB
File Modification Date/Time     : 2023:08:15 17:46:35+02:00
File Access Date/Time           : 2023:08:16 13:23:41+02:00
File Inode Change Date/Time     : 2023:08:16 13:23:39+02:00
File Permissions                : -rw-r--r--
File Type                       : TIFF
File Type Extension             : tif
MIME Type                       : image/tiff
Exif Byte Order                 : Little-endian (Intel, II)
Subfile Type                    : Full-resolution image
Image Width                     : 6000
Image Height                    : 4000
Bits Per Sample                 : 16 16 16
Compression                     : Uncompressed
Photometric Interpretation      : RGB
Make                            : RICOH IMAGING COMPANY, LTD.
Camera Model Name               : RICOH GR III
Strip Offsets                   : 30796
Samples Per Pixel               : 3
Rows Per Strip                  : 4000
Strip Byte Counts               : 144000000
X Resolution                    : 240
Y Resolution                    : 240
Planar Configuration            : Chunky
Resolution Unit                 : inches
Software                        : Adobe Photoshop Lightroom Classic 12.4 (Macintosh)
Modify Date                     : 2023:08:15 17:46:35
XMP Toolkit                     : Adobe XMP Core 7.0-c000 1.000000, 0000/00/00-00:00:00
Creator Tool                    : Adobe Photoshop Lightroom Classic 12.4 (Macintosh)
Rating                          : 1
Metadata Date                   : 2023:08:15 17:46:35+02:00
Label                           : Green
Document ID                     : xmp.did:7fd20eb1-e096-44f3-9e72-57cf3bfd679e
Preserved File Name             : _R015971.DNG
Original Document ID            : 9EE46199D705502EE41A02D5F38A864A
Instance ID                     : xmp.iid:7fd20eb1-e096-44f3-9e72-57cf3bfd679e
Format                          : image/tiff
Raw File Name                   : 20230814.1431 — RICOH GR III-Enhanced-RD.dng
Coded Character Set             : UTF8
Application Record Version      : 4
Date Created                    : 2023:08:14
Time Created                    : 14:31:36
Digital Creation Date           : 2023:08:14
Digital Creation Time           : 14:31:36
Photoshop Thumbnail             : (Binary data 15341 bytes, use -b option to extract)
IPTC Digest                     : 77a566f72ee57f250ae038ed6d31873d
Exposure Time                   : 1/1000
F Number                        : 5.6
Exif Version                    : 0231
Date/Time Original              : 2023:08:14 14:31:36
Create Date                     : 2023:08:14 14:31:36
Offset Time                     : +02:00
Shutter Speed Value             : 1/1000
Aperture Value                  : 5.6
Modify Date                     : 2023:08:15 17:46:35+02:00
Date/Time Created               : 2023:08:14 14:31:36
Digital Creation Date/Time      : 2023:08:14 14:31:36
Circle Of Confusion             : 0.020 mm
Field Of View                   : 65.5 deg
Focal Length                    : 18.3 mm (35 mm equivalent: 28.0 mm)
Hyperfocal Distance             : 3.05 m
Light Value                     : 14.9
Screenshot 2023-08-16 at 13 32 28

In the attached image from the webview, you can see that the image is correctly identified as being GMT+2 but the taking time is also shifted two hours forward. The correct time should be 14:31 GMT+02:00 whereas in the web view it is 16:31 GMT+02:00. These images are directly exported from lightroom which reflects their taking times accurately. Google Photos and my local system also correctly identify taking time.

AngelaDMerkel avatar Aug 16 '23 11:08 AngelaDMerkel

You probably should set TZ on the container. If the image has no timezone, it falls back to the container timezone. If the container doesn't have a timezone it will use UTC+0

jrasm91 avatar Aug 16 '23 13:08 jrasm91

The container specifies the offset as +2 which indicates that this is UTC+02:00. The thing is, this is an image exported directly from Lightroom and represents a pretty standard formatting for what I imagine are many users images. Having Immich properly manage the most popular raw processing software is probably a smart idea.

AngelaDMerkel avatar Aug 16 '23 15:08 AngelaDMerkel

This doesn't have anything to do with lightroom. The original image does not have any timezone information in it:

Date/Time Original              : 2023:08:14 14:31:36
Create Date                     : 2023:08:14 14:31:36

No timezone = fallback to the timezone of the machine when metadata extraction happens. The "machine" is the immich-microservices docker container, which does not have a timezone by default, so the only thing that can be done is assume this picture was taken at 2023:08:14 14:31:36+0

jrasm91 avatar Aug 16 '23 15:08 jrasm91

This does have to do with Lightroom. The way Lightroom is encoding the timezone information is with the Offset Time field.

Date/Time Original              : 2023:08:14 14:31:36
Create Date                     : 2023:08:14 14:31:36
Offset Time                     : +02:00

+02:00 is to specify it is CEST or GMT+02:00. Immich is simply not properly interpreting that data. Of the utilities I use, Immich is the only one which improperly identifies the timezone information. This is fairly well documented in the exiftool forums where it's standard practice for EXIF:OffsetTime to be used to specify time zone as distance from UTC.

AngelaDMerkel avatar Aug 16 '23 15:08 AngelaDMerkel

We're looking to release something which should resolve this, but blocked on an upstream package. I think we'll pin to a branch instead of a formal release to move this along.

uhthomas avatar Aug 16 '23 15:08 uhthomas

Immich is simply not properly interpreting that data.

Ah, I see. I did not realize you were referring to the actual Offset Time exif tag, your comments make more sense now :smile:

jrasm91 avatar Aug 16 '23 16:08 jrasm91

@jrasm91 Apologies if I was unclear. I could have been more precise.

AngelaDMerkel avatar Aug 16 '23 16:08 AngelaDMerkel

I have been testing this more to see any other edge cases which might occur, and there are several, including in cases where the camera time is incorrect and then shifted forward some hours into a different timezone. The metadata for this file is:

Modify Date                     : 2023:08:17 21:03:21+02:00
Create Date                     : 2019:02:12 22:01:27-05:00
Metadata Date                   : 2023:08:17 21:03:21+02:00

Immich is using create date to lift timezone information, but that is simply not correct and doesn't reflect the actual time of the image.

AngelaDMerkel avatar Aug 17 '23 19:08 AngelaDMerkel

Fixed by #2908

bo0tzz avatar Sep 18 '23 13:09 bo0tzz