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 #3667

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

Conversation

rnigro-rwb
Copy link

@rnigro-rwb rnigro-rwb commented Nov 8, 2023

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.

@HoekWax
Copy link

HoekWax commented Nov 15, 2023

Hello @HackbrettXXX, is it possible to check and merge this fix ? We are multiple people facing this issue.

I can provide an image that creates the issue when used using addImage if you want me to.

Thanks.

@rnigro-rwb
Copy link
Author

Linking PR to issue.

Fixes #3318

@HoekWax
Copy link

HoekWax commented Nov 27, 2023

Hello @MrRio, can you or someone else review and merge this request ? Thanks

@racosa
Copy link
Contributor

racosa commented May 20, 2024

We also had this issue and this PR fixes it. Can someone merge this, please?

@rnigro-rwb rnigro-rwb force-pushed the 3318-jpeg-size-determination branch from 312ae22 to 0d4bddd Compare September 17, 2024 13:51
@rnigro-rwb
Copy link
Author

rnigro-rwb commented Sep 17, 2024

@MrRio, @HackbrettXXX

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.

@github-actions github-actions bot added the Stale label Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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