Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract XMP data from embedded JPEG preview inside RAF files #2613

Merged
merged 4 commits into from
May 19, 2023

Conversation

cytrinox
Copy link
Contributor

The Fujifilm X-T5 camera stores in-camera rating for RAF images by using XMP. But the XMP data is not directly encoded into the RAF structure - instead it is attached as a second APP1 segment to the embedded JPEG preview file.

This patch extracts the JPEG preview and parses it like a standalone JPEG file.

fixes #2610

@cytrinox
Copy link
Contributor Author

To verify #2610 one can use:

exiv2 --Print IkytEX ../_DSF0052.RAF

The XMP rating is now printed:

Xmp.xmp.Rating                               XmpText    4

@cytrinox
Copy link
Contributor Author

@kmilos Here we go. Maybe you can have a look at it - I've touched C++ code long time ago 😄

There is one thing that could be improved: The JpegImage metadata parser already parses exif and other information. There is no need to keep the old direct method by using TiffParser. But I don't know how the get the byte order for setByteOrder(bo);.

@cytrinox cytrinox marked this pull request as ready for review May 10, 2023 20:26
@ghost
Copy link

ghost commented May 10, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@kmilos kmilos added enhancement feature / functionality enhancements imageHandler Anything related to specific ImageHandlers labels May 11, 2023
src/rafimage.cpp Outdated Show resolved Hide resolved
src/rafimage.cpp Outdated Show resolved Hide resolved
The Fujifilm X-T5 camera stores in-camera rating for RAF images
by using XMP. But the XMP data is not directly encoded into the
RAF structure - instead it is attached as a second APP1 segment
to the embedded JPEG preview file.

This patch extracts the JPEG preview and parses it like a standalone
JPEG file.
Remove manual TiffParser usage for reading APP1 segement,
instead use JpegImage for proper parsing.
src/rafimage.cpp Outdated Show resolved Hide resolved
@kmilos
Copy link
Collaborator

kmilos commented May 16, 2023

Ah, probably want to wrap the whole JPEG parsing (incl. the two preview tags) in a try-catch now, or update the expected test output...

@codecov
Copy link

codecov bot commented May 17, 2023

Codecov Report

Merging #2613 (c493e38) into main (c86ae6a) will decrease coverage by 0.01%.
The diff coverage is 35.71%.

@@            Coverage Diff             @@
##             main    #2613      +/-   ##
==========================================
- Coverage   63.92%   63.92%   -0.01%     
==========================================
  Files         103      103              
  Lines       22309    22306       -3     
  Branches    10795    10796       +1     
==========================================
- Hits        14262    14259       -3     
- Misses       5825     5827       +2     
+ Partials     2222     2220       -2     
Impacted Files Coverage Δ
src/rafimage.cpp 20.29% <35.71%> (-0.84%) ⬇️

... and 4 files with indirect coverage changes

@cytrinox
Copy link
Contributor Author

Ah, probably want to wrap the whole JPEG parsing (incl. the two preview tags) in a try-catch now, or update the expected test output...

fixed.

src/rafimage.cpp Show resolved Hide resolved
src/rafimage.cpp Show resolved Hide resolved
@kmilos
Copy link
Collaborator

kmilos commented May 17, 2023

Almost there! 👍

@kmilos kmilos merged commit 05ccb5a into Exiv2:main May 19, 2023
108 checks passed
@kmilos
Copy link
Collaborator

kmilos commented May 19, 2023

@Mergifyio backport 0.28.x

@mergify
Copy link
Contributor

mergify bot commented May 19, 2023

backport 0.28.x

✅ Backports have been created

kmilos added a commit that referenced this pull request May 19, 2023
Extract XMP data from embedded JPEG preview inside RAF files (backport #2613)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature / functionality enhancements imageHandler Anything related to specific ImageHandlers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing Exif.Fujifilm.Rating tag for Fujifilm XT-5 RAF files
3 participants