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 getJpegInfo to skip DHT marker #3854

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rnigro-rwb
Copy link

Fixes #3318.

getJpegInfo now skips the DHT marker (0xc4) because that marker is not a SOF (start of frame) marker and therefore the segment to follow does not have the size information.

To add to insight to this fix, the original getJpegInfo sites http://www.64lines.com/jpeg-width-height which itself sites a reference for header info: JPEG Header Information

As you can see here, Define Huffman table marker (FFC4), 0xC4 is a marker for the Huffman table.

My fix skips 0xC4 and adjusts the remaining Start of frame (SOFn) markers to be correct.

@rnigro-rwb rnigro-rwb marked this pull request as ready for review April 3, 2025 14:39
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.

jsPDF images are corrupted when using large, smartphone-captured jpegs
2 participants