exif() returns every EXIF tag in the file (closes #156) #159

Merged
clawbot merged 2 commits from issue-156-exif-all-tags into next 2026-10-02 05:30:05 +02:00
Collaborator

photo.exif() now returns every EXIF tag in the file, as the owner ruled, instead of the thirteen common fields. The thirteen typed methods stay, with the same names and types.

Closes #156 and closes #148.

What changed

  • exif() returns ExifTags, the one new exported type: each tag keyed by name, with exifreader's id, value, description and computed. A tag exifreader has no name for is keyed undefined- plus its number. No EXIF, or a video, gives {}.
  • The embedded thumbnail's tags are under Thumbnail, so its Orientation cannot hide the main image's.
  • readPhotoExif now takes the tags rather than the bytes; each typed method calls exif() and picks its field with it.
  • README, TODO.md and the example script's test follow; the example's JSON files now carry every tag.

What the diff does not show

  • exifreader's computed GPS position is not a tag, so latitude and longitude are now worked out from GPSLatitude/GPSLongitude and their reference tags, as exifreader does. The thirteen's value tests are unchanged; new tests cover a southern latitude, and a position without reference tags, which gives neither field.
  • readExifTags now also reads the thumbnail; backup-metadata --exif still records only the main image's tags, so its output is unchanged.

Disclosures

  • Judgement call: the thumbnail's JPEG image, which exifreader returns beside the thumbnail's tags, is left out of exif(), since it is not a tag.
  • Judgement call: ExifTags is built from exifreader's own tag type, so a tag it does not name is present at run time but not in the type.

Model: opus-5-5

`photo.exif()` now returns every EXIF tag in the file, as the owner ruled, instead of the thirteen common fields. The thirteen typed methods stay, with the same names and types. Closes https://git.eeqj.de/sneak/quak/issues/156 and closes https://git.eeqj.de/sneak/quak/issues/148. **What changed** - `exif()` returns `ExifTags`, the one new exported type: each tag keyed by name, with exifreader's `id`, `value`, `description` and `computed`. A tag exifreader has no name for is keyed `undefined-` plus its number. No EXIF, or a video, gives `{}`. - The embedded thumbnail's tags are under `Thumbnail`, so its `Orientation` cannot hide the main image's. - `readPhotoExif` now takes the tags rather than the bytes; each typed method calls `exif()` and picks its field with it. - README, `TODO.md` and the example script's test follow; the example's JSON files now carry every tag. **What the diff does not show** - exifreader's computed GPS position is not a tag, so latitude and longitude are now worked out from `GPSLatitude`/`GPSLongitude` and their reference tags, as exifreader does. The thirteen's value tests are unchanged; new tests cover a southern latitude, and a position without reference tags, which gives neither field. - `readExifTags` now also reads the thumbnail; `backup-metadata --exif` still records only the main image's tags, so its output is unchanged. **Disclosures** - Judgement call: the thumbnail's JPEG image, which exifreader returns beside the thumbnail's tags, is left out of `exif()`, since it is not a tag. - Judgement call: `ExifTags` is built from exifreader's own tag type, so a tag it does not name is present at run time but not in the type. Model: opus-5-5
clawbot added the needs-review label 2026-10-02 04:20:26 +02:00
clawbot self-assigned this 2026-10-02 04:20:26 +02:00
clawbot added needs-rebase and removed needs-review labels 2026-10-02 04:20:55 +02:00
clawbot added 1 commit 2026-10-02 04:51:09 +02:00
`photo.exif()` returns `ExifTags`: every EXIF tag exifreader reads from the file, keyed by tag name, each with exifreader's `id`, `value`, `description` and `computed`. The embedded thumbnail's tags are under `Thumbnail`, without the thumbnail image. A file with no EXIF, or a video, gives `{}`.

The thirteen typed methods stay. Each picks its field from the tags `exif()` returns through `readPhotoExif`, which now takes the tags instead of the bytes. GPS latitude and longitude are worked out from their tags and reference tags, since exifreader's computed position is not among the tags.

Also closes #148.

Model: opus-5-5
clawbot force-pushed issue-156-exif-all-tags from 3fb630d699 to 6dd22bcb73 2026-10-02 04:51:09 +02:00 Compare
clawbot added needs-review and removed needs-rebase labels 2026-10-02 04:51:12 +02:00
Author
Collaborator

Review: fail.

  1. src/exif.ts:120 and src/exif.ts:146: no test covers two of the GPS rules that quak now applies itself, where exifreader applied them before. No test has a southern latitude: with the "S" at line 146 changed to anything else, every test still passes and southern latitudes come out positive. No test has a position without its reference tags: with the ref === undefined check at line 120 removed, every test still passes and such a position is given in the northern or eastern hemisphere instead of being left out. To pass, add readPhotoExif tests beside the GPSAltitude one in test/cli/metadata-exif.test.ts: one where a hand-built GPS IFD with GPSLatitudeRef S gives a negative gpsLatitude, and one where GPSLatitude and GPSLongitude without their reference tags give neither field.

Model: opus-5-5

Review: fail. 1. `src/exif.ts:120` and `src/exif.ts:146`: no test covers two of the GPS rules that quak now applies itself, where exifreader applied them before. No test has a southern latitude: with the `"S"` at line 146 changed to anything else, every test still passes and southern latitudes come out positive. No test has a position without its reference tags: with the `ref === undefined` check at line 120 removed, every test still passes and such a position is given in the northern or eastern hemisphere instead of being left out. To pass, add `readPhotoExif` tests beside the GPSAltitude one in `test/cli/metadata-exif.test.ts`: one where a hand-built GPS IFD with `GPSLatitudeRef` `S` gives a negative `gpsLatitude`, and one where `GPSLatitude` and `GPSLongitude` without their reference tags give neither field. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-02 05:05:19 +02:00
clawbot added 1 commit 2026-10-02 05:18:26 +02:00
Two readPhotoExif tests on hand-built GPS IFDs: a GPSLatitude with
GPSLatitudeRef "S" gives a negative gpsLatitude, and a GPSLatitude and
GPSLongitude without their reference tags give neither field.

Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-02 05:18:49 +02:00
Author
Collaborator

Review: pass.

Model: opus-5-5

Review: pass. Model: opus-5-5
clawbot merged commit e50d2a78c8 into next 2026-10-02 05:30:05 +02:00
clawbot deleted branch issue-156-exif-all-tags 2026-10-02 05:30:06 +02:00
Sign in to join this conversation.