Skip to content

feat: read camera-embedded rating from RAW/EXIF & XMP - #1529

Open
csiroqa wants to merge 5 commits into
CyberTimon:mainfrom
csiroqa:fix/read-camera-rating
Open

feat: read camera-embedded rating from RAW/EXIF & XMP#1529
csiroqa wants to merge 5 commits into
CyberTimon:mainfrom
csiroqa:fix/read-camera-rating

Conversation

@csiroqa

@csiroqa csiroqa commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Images the user never edited in RapidRAW had no rating (0) because the read path only looked at the .rrdata sidecar and XMP sidecars. Pull a rating from embedded XMP \xmp:Rating\ and the private EXIF Rating tag (0x4746) when .rrdata has none, so camera-assigned stars show up again.

Closes #1130, #517

Description

Star ratings assigned in-camera (e.g. Lumix/Panasonic, Sony) were not shown in RapidRAW because the read path only looked at the .rrdata sidecar (and an optional .xmp file). For images never edited in RapidRAW the .rrdata has rating: 0, and nothing ever pulled the camera's rating back in.

This makes the read path fall back to the two interoperable carriers that cameras/other tools actually use: embedded XMP xmp:Rating and the private EXIF Rating tag (0x4746).

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Performance improvement
  • Code refactoring
  • Documentation update
  • UI/UX improvement
  • Build/CI or Dependency update

Changes Made

  • src-tauri/src/exif_processing.rs
    • new read_image_rating(path, bytes): tries embedded XMP xmp:Rating (attribute and element forms) first, then the private EXIF Rating tag (0x4746).
    • xmp:Rating -1 (rejected) is treated as "not a star" (None), so a rejected photo never shows up as a 1-star.
    • unit tests for the XMP/rating mapping.
  • src-tauri/src/file_management.rs

Screenshots/Videos

Testing

  • These changes were tested locally by a human and confirmed to work.
  • I haven't added any automated tests to the code because the codebase currently lacks a test suite.

Test Configuration:

  • OS: (e.g. Windows 11, macOS Sonoma, Ubuntu 24.04)
  • Hardware: (e.g. Intel i7, Apple M2, Nvidia RTX 3060)

Checklist

  • My code follows the project's code style
  • I haven't added unnecessary AI-generated code comments
  • My changes generate no new warnings or errors

Additional Notes

Coverage depends on where each camera writes the rating (embedded XMP vs EXIF 0x4746). Reported #1130 (RW2) and #517 (Sony) are the targets; if a specific camera writes elsewhere (e.g. RatingPercent 0x4749), that can be a small follow-up once we have a sample.

AI Disclaimer:

Please state the involvement of AI in this PR:

  • This PR is created by an AI agent
  • This PR is mostly AI-generated but edited/merged together by a human
  • This PR was handwritten with AI assistance (spell check, logic suggestions, error resolving)
  • This PR contains only blood, sweat, and coffee (AI-free)

Images the user never edited in RapidRAW had no rating (0) because the
read path only looked at the .rrdata sidecar and XMP sidecars. Pull a
rating from embedded XMP \xmp:Rating\ and the private EXIF Rating tag
(0x4746) when .rrdata has none, so camera-assigned stars show up again.

Closes CyberTimon#1130, CyberTimon#517
@csiroqa
csiroqa requested a review from CyberTimon as a code owner August 17, 2026 01:22
@CyberTimon

Copy link
Copy Markdown
Owner

Can you remove the testing suite, remove all code comments and confirm it doesn't do any double reads etc? I haven't had time to test this properly, but I had many file double read scenarios while I tried to also implement this back then

@csiroqa

csiroqa commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Can you remove the testing suite, remove all code comments and confirm it doesn't do any double reads etc? I haven't had time to test this properly, but I had many file double read scenarios while I tried to also implement this back then

I’ve begun to deal with that

@csiroqa

csiroqa commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Updated the branch (2ae8542, c035b79, cef0c7c): testing suite and all comments removed; the rating fallback now reuses the existing read_exif_for_paths read (same mmap), so folder scans add no file reads. Camera rating shows up on demand via the Properties/EXIF read. cargo fmt and clippy (with -D warnings) both pass.

@csiroqa

csiroqa commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

the existing EXIF read reused.

  • src-tauri/src/exif_processing.rs
    • read_image_rating: embedded XMP xmp:Rating (attribute + element forms) first, then private EXIF Rating (0x4746); -1 ("rejected") → no rating; regexes compiled once.
  • src-tauri/src/file_management.rs
    • read_exif_for_paths hydrates Rating into the EXIF map on its existing read (no extra file reads; mmap and fs::read paths both covered).
  • src/hooks/useAppNavigation.ts
    • Surfaces the rating into image.rating / imageRatings, so grid stars and rating filter show camera ratings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Rating not read from Panasonic/Lumix RW2 file

2 participants