feat: add WebP (RIFF/WEBP) image EXIF support#61
Open
mindeng wants to merge 11 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #61 +/- ##
==========================================
+ Coverage 90.52% 90.69% +0.16%
==========================================
Files 38 39 +1
Lines 8593 8921 +328
==========================================
+ Hits 7779 8091 +312
- Misses 814 830 +16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds WebP image support to
nom-exif: detects RIFF/WEBP files and extracts EXIF/GPS from theEXIFchunk via the unifiedparse_exif/read_exif(sync + async) APIs. Scope is EXIF-only (no XMP).src/file.rs): newMediaMimeImage::Webp+check_webp("RIFF"…"WEBP"), wired into the detection chain.src/webp.rs):webp::extract_exif(state, buf)walks the chunk stream, skipping large image-bitstream chunks viaClearAndSkip, returning theEXIFpayload (raw TIFF). Bounds the walk by the RIFF size field (WebP has no terminator chunk) and threads the remaining-bytes bound across skips viaParsingState::WebpPastHeader(usize). Strips a strayExif\0\0marker if an encoder wrote one.src/exif.rs): rides the existingextract_exif_with_mimepath — reuses the sync and async drivers with zero async-specific code. NewMalformedKind::WebpChunk.src/parser.rs): small-file tolerance widened fromPngtoPng | Webp.Design notes
WebP EXIF sits after the image bitstream, so the walker must skip potentially-large
VP8/VP8L/ANMFchunks to reach it — handled byClearAndSkipwith the RIFF-size bound carried across the skip. A no-EXIF WebP terminates cleanly withError::ExifNotFoundrather than reading to EOF.Full design + implementation plan under
docs/superpowers/.Test Plan
cargo test— 427 passed, 0 failed (default features)cargo test --features tokio— 432 passed, 0 failedcargo fmt --checkclean;cargo clippy --all-targets --all-featuresno issues