Initial Commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
# Capability Spec: exif
|
||||
|
||||
**Package**: `@suaveplan/exif`
|
||||
**Version**: 0.0.0 (genesis)
|
||||
**Status**: ADDED
|
||||
|
||||
---
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### EXIF-01 — Format detection
|
||||
`detectImageFormat(bytes)` MUST identify JPEG, PNG, WebP, TIFF, HEIC (ISOBMFF), and the RAW families (CR2, CR3, NEF, ARW, RAF, ORF, RW2, DNG) by magic-byte sniffing. Unknown inputs MUST return `'unknown'`, not throw.
|
||||
|
||||
### EXIF-02 — Read / write / strip dispatch
|
||||
`readMetadata(bytes, options?)` MUST dispatch to the format-specific reader and return a unified `ImageMetadata`. `writeMetadata(bytes, patch)` MUST apply a `MetadataPatch` and return a new buffer. `stripMetadata(bytes, options?)` MUST produce a buffer containing image data only; running it twice MUST be idempotent.
|
||||
|
||||
### EXIF-03 — IFD codec
|
||||
`parseTiff(bytes, options?)` MUST return `ParsedTiff` with every IFD, entry, and sub-IFD. `buildTiff(input)` MUST produce a byte buffer that round-trips through `parseTiff` to an equal `ParsedTiff`. Entry type widths MUST follow `TIFF_TYPE_SIZE`.
|
||||
|
||||
### EXIF-04 — GPS
|
||||
`decimalToDms` and `dmsToDecimal` MUST round-trip within 1e-7 degrees. `gpsToIsoTimestamp` and `isoToGpsFields` MUST round-trip to second precision.
|
||||
|
||||
### EXIF-05 — ICC
|
||||
`readIccProfile` MUST return `IccProfile` with header, tag table, and parsed tag values. `validateIccProfile` MUST reject profiles with invalid size, version, or checksum. `classifyProfile` MUST detect `sRGB`, `AdobeRGB`, `DisplayP3` reliably for canonical profiles.
|
||||
|
||||
### EXIF-06 — IPTC / XMP
|
||||
`readIptc` / `writeIptc` MUST support IIM records 1, 2 with UTF-8 and ISO-8859-1 charsets. `readXmp` MUST return an `XmpData` tree (scalars, structs, language-alternatives). `XMP_NAMESPACES` MUST expose the canonical URI per prefix.
|
||||
|
||||
### EXIF-07 — MakerNotes
|
||||
`decodeMakerNote` MUST dispatch to the correct vendor decoder. Nikon and Sony encrypted MakerNote tags MUST be decoded via `nikonDecrypt` / `sonyDecrypt` using the serial+shutter-derived keys. `decodeAppleMakerNote` MUST decode embedded bplist via `decodeBplist`.
|
||||
|
||||
### EXIF-08 — Safety
|
||||
All readers MUST operate on bounded `ByteReader` views and MUST throw `EXIF.BUFFER_OVERRUN` rather than reading past the buffer end. No reader MUST allocate buffers larger than the input.
|
||||
|
||||
### EXIF-09 — Observability
|
||||
Every read/write/strip MUST record the corresponding OTel histogram with label `format`.
|
||||
Reference in New Issue
Block a user