Skip to content

feat(server): check additional exif date tags #19216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 26, 2025

Conversation

midzelis
Copy link
Collaborator

@midzelis midzelis commented Jun 16, 2025

  • Add support for GPS based DateTime tag, and a few other to match exiftool-vendored behavior when extracting timezone for an image. (extractTzOffsetFromUTCOffset())
    • GPSDateTime
    • DateTimeUTC
    • SonyDateTime2

Note: Date-only or Time-only tags will not be considered as a valid DateTime source, but they will still be used to extract the timezone offset by exiftool-vendored.

Fixes the issue reported with the sample photo here: #12650 (comment)

- Add support for UTC date tags (GPSDateTime, DateTimeUTC, GPSDateStamp, SonyDateTime2)
- This matches tags that exiftool-vendored uses for tzSource in extractTzOffsetFromUTCOffset()
@midzelis midzelis requested a review from alextran1502 June 18, 2025 01:41
Copy link
Member

@danieldietzler danieldietzler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we get e2e tests for some of them? Add a sample asset that has (some of) those to test-assets?

'SourceImageCreateTime' as keyof Tags,
];
'SourceImageCreateTime',
] as Array<keyof ImmichTags>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this from a type hint to casting the array? With the old way you'd get autocompletion/type hints inside the array which I think is valuable.

try {
const imagePath = join(targetDir, image.filename);

// Create unique JPEG file using Sharp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a thing for that https://github.com/immich-app/immich/blob/main/e2e/src/generators.ts#L24-L31 so no need to pull sharp in for that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PNG images can't have exif

I tried constructing 1 pixel jpg from bytes and sharp always complained of invalid headers or other corruption. So I just decided to use sharp. It's not a new dependency. We already use it :)

@headtr1ck
Copy link

Thanks! I have some pictures from Apple devices with only GPSDateTime tags, this should solve the issue :)

@alextran1502 alextran1502 merged commit 934649c into main Jun 26, 2025
52 checks passed
@alextran1502 alextran1502 deleted the fix/additional_exif_datetime branch June 26, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants