mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-12 08:52:32 +00:00
* Add craft-crs: Camera Raw crs: settings in XMP, read and written, from PhotoCraft The format half of PhotoCraft's Camera Raw settings files (crates/io/src/camera_raw_xmp.rs at abeb16c96): the crs: settings of an XMP packet as written, Camera Raw's number and curve point text, the crop and its orientation, a writer, and the toolkit marker. Which setting drives which control stays in the app. * craft-crs: structures carry their element and are written back Local corrections and other structured settings were dropped, and an rdf:Seq of descriptions read as empty strings. A structure now holds its crs: element, a sequence is only plain text items, descriptions inside a structure are not read as top-level settings, and to_xmp writes structures back. * craft-crs: read packets through craft-metadata's XMP reader One XMP reader for every crate: Settings::parse goes through craft_metadata::parse_xmp and Settings::from_xmp takes its XmpData. Settings are kept by name (the reader's map has no file order), structures are craft-metadata's XmpValue and are written back as rdf:parseType Resource elements and rdf:Seq arrays. toolkit stays a bounded first-start-tag scan, as the reader does not return x:xmptk.
1.8 KiB
1.8 KiB
craft-crs
Adobe Camera Raw settings: the crs: namespace (http://ns.adobe.com/camera-raw-settings/1.0/)
in an XMP packet, as Camera Raw's Save Settings writes an .xmp settings file and as Camera Raw,
Lightroom and Bridge write a raw file's sidecar.
Settings::parsereads a file;Settings::from_xmptakes a packet already read bycraft_metadata::parse_xmp. Settings come back by name (Exposure2012), the last one winning where a name repeats: text from an attribute or a plain element, the plain items of anrdf:Seq, or a structure (crs:GradientBasedCorrectionsand other local corrections) ascraft_metadata'sXmpValue, for the caller to read. The file's own prefixes do not matter. A description inside a structure belongs to the structure, not to the settings.number,signedandpoints: Camera Raw's numbers (+0.50) and tone curve points ("32, 22").Settings::crop: the crop rectangle, only whenHasCropisTrue; straightened, inverted, empty or unreadable crops are reported as unusable with the keys present.Crop::orientedandCrop::pixelsplace it on an upright frame of a given size.Settings::to_xmp: a settings file Camera Raw's Load Settings reads, structures included, naming the toolkit that wrote it;toolkitreads that name back.
Which setting drives which control, and the ranges they clamp to, are the application's.
Limits
| Limit | Value |
|---|---|
| Input | 4 MiB (MAX_XMP_BYTES) |
| Nesting and size of the packet | craft-metadata's XMP limits |
| Structure depth written | 64 (MAX_WRITE_DEPTH) |
XMP
Packets are read by craft-metadata's XMP reader, the one every crate shares. toolkit reads
only the x:xmptk attribute of the first x:xmpmeta start tag, with a bounded craft-xml scan,
because that reader does not return it.