exif() returns every EXIF tag in the file (closes #156)
check / check (push) Failing after 59s
check / check (push) Failing after 59s
`photo.exif()` now returns every EXIF tag in the file, as the owner ruled, typed `ExifTags`: each tag keyed by name with `exifreader`'s `id`, `value`, `description` and `computed`. A tag with no name is keyed `undefined-` plus its number, and the embedded thumbnail's tags sit under `Thumbnail`. The thirteen typed methods stay, with the same names and types; each now picks its field from `exif()`'s tags. GPS latitude and longitude are worked out from the GPS tags and their reference tags, and a position with no reference tags gives neither. `backup-metadata --exif` output is unchanged. Model: opus-5-5 Co-authored-by: clawbot <sneak+clawbot@sneak.cloud>
This commit was merged in pull request #159.
This commit is contained in:
@@ -101,7 +101,8 @@ requires one, and writes:
|
||||
photo its image, its video and the `.livephoto.json` file naming them
|
||||
- beside each original, a JSON file named after it with `.json` added, for
|
||||
example `2026-03-01.12345.jpg.json`: the photo's record (`photo.record()`)
|
||||
without its cache paths, and its EXIF fields (`photo.exif()`) under `exif`
|
||||
without its cache paths, and every EXIF tag of the photo (`photo.exif()`)
|
||||
under `exif`
|
||||
- `albums/<collectionID>.json` for each album: its `collectionID`, its `name`,
|
||||
and under `savePaths` the save paths of its photos relative to `dir`, newest
|
||||
first
|
||||
@@ -773,21 +774,25 @@ These async methods may download:
|
||||
- `await photo.thumbnail(opts?)` → `{ path, bytes }`.
|
||||
- `await photo.content(opts?)` → `Uint8Array` — the original's bytes, read
|
||||
through `original()`; for a live photo, its image's.
|
||||
- `await photo.exif(opts?)` → `PhotoExif` — `make`, `model`, `lensModel`,
|
||||
`dateTimeOriginal`, `offsetTimeOriginal`, `exposureTime`, `fNumber`, `iso`,
|
||||
`focalLength`, `orientation`, `gpsLatitude`, `gpsLongitude` and `gpsAltitude`,
|
||||
each absent when the file lacks it. GPS values are signed decimal degrees and
|
||||
metres. `dateTimeOriginal` is the camera's clock reading held in the `Date`'s
|
||||
UTC fields; `offsetTimeOriginal`, when present, is that clock's offset from
|
||||
UTC. EXIF is read from any image format exifreader reads (such as JPEG,
|
||||
HEIC/HEIF, AVIF, PNG, WebP and TIFF), a live photo's image included. Any other
|
||||
original gives `{}`, and a video gives `{}` without being downloaded.
|
||||
- `await photo.exif(opts?)` → `ExifTags` — every EXIF tag in the file, keyed by
|
||||
tag name, each as exifreader decodes it, with its `id`, `value`, `description`
|
||||
and `computed` value: for example `Make` is
|
||||
`{ id: 271, value: ["Canon"], description: "Canon", computed: "Canon" }`. A
|
||||
tag exifreader has no name for is keyed `undefined-<tag number>`. The embedded
|
||||
thumbnail's tags are under `Thumbnail`, so they cannot hide the main image's
|
||||
tags of the same name; the thumbnail image itself is left out. EXIF is read
|
||||
from any image format exifreader reads (such as JPEG, HEIC/HEIF, AVIF, PNG,
|
||||
WebP and TIFF), a live photo's image included. Any other original gives `{}`,
|
||||
and a video gives `{}` without being downloaded.
|
||||
- `await photo.make(opts?)`, and likewise `model()`, `lensModel()`,
|
||||
`dateTimeOriginal()`, `offsetTimeOriginal()`, `exposureTime()`, `fNumber()`,
|
||||
`iso()`, `focalLength()`, `orientation()`, `gpsLatitude()`, `gpsLongitude()`
|
||||
and `gpsAltitude()` → one field of `exif()` each, typed as in `PhotoExif`, or
|
||||
`undefined` when the file lacks it. Each calls `exif()` with its `opts`, so
|
||||
each call reads the original again.
|
||||
and `gpsAltitude()` → one common field each, picked from the tags `exif()`
|
||||
returns and typed as in `PhotoExif`, or `undefined` when the file lacks it.
|
||||
GPS values are signed decimal degrees and metres. `dateTimeOriginal()` is the
|
||||
camera's clock reading held in the `Date`'s UTC fields;
|
||||
`offsetTimeOriginal()`, when present, is that clock's offset from UTC. Each
|
||||
calls `exif()` with its `opts`, so each call reads the original again.
|
||||
|
||||
They serve from the on-disk content cache when the bytes are present and
|
||||
otherwise fetch through the pools; `original()`, `content()` and `exif()` also
|
||||
@@ -904,7 +909,7 @@ from a very old client, is stored unchecked.
|
||||
- `src/library/records.ts`: `PhotoRecord`, `AlbumRecord`, `LibrarySnapshot`,
|
||||
`LibraryChange`
|
||||
- `src/library/mlsearch.ts`: `MLDataAPI`, `SimilarResult`
|
||||
- `src/exif.ts`: `PhotoExif`
|
||||
- `src/exif.ts`: `ExifTags`, `PhotoExif`
|
||||
- `src/library/pools.ts`: `RequestPools`, `RequestPoolsOptions`, `BoundedPool`
|
||||
- `src/backup.ts`: `BackupOptions`, `BackupResult`, `BackupError`
|
||||
- `src/client.ts`: `Client`, `LoginOptions`, `ClientSnapshot`
|
||||
|
||||
Reference in New Issue
Block a user