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

fix: tag value handling #14

Merged
merged 2 commits into from
Sep 22, 2024
Merged

Conversation

Friendseeker
Copy link
Contributor

Issue

_getTagValue has following problems

  • Case 9 (SLONG), Case 129 (UTF-8) is not handled
  • Case 10 is as quotient of two SLONGs, yet currently it is fetched as quotient of two LONGs
  • All of Case 1,3,4,5,9,10 can result in array of values, yet only case 5 returns an array

This PR fixes the above 3 problems, so _getTagValue is fully in sync with EXIF spec.

Comment on lines 57 to 63
export const readInt32BE = (array, offset) => {
return readUInt32BE(array, offset) | 0;
};

export const readInt32LE = (array, offset) => {
return readUInt32LE(array, offset) | 0;
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these needed?

Also please add a new line at the end of the file :)

Copy link
Contributor Author

@Friendseeker Friendseeker Sep 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are for handling Case 9 & 10. Here's excerpt from EXIF standard:

9 = SLONG A 32-bit (4-byte) signed integer (2's complement notation).
10 = SRATIONAL Two SLONGs. The first SLONG is the numerator and the second SLONG is the
denominator.

Hence I added these methods to read signed ints, as existing methods only read unsigned numbers.

@diegomura diegomura merged commit 156cad7 into diegomura:main Sep 22, 2024
3 checks passed
@Friendseeker Friendseeker deleted the signed-int-handling branch September 22, 2024 18:46
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.

2 participants