-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
less "conventional" Indexed 4 bit RGB colour format not handled correctly. #2660
Comments
The issue is coming from the color table. it starts with \xFF\xFE which is understood as UTF-16LE BOM which induce byte swapping because of #1884. Under analysis. |
Note that there are more comments in the Stack Overflow answer. I should have copied it all here. Sorry for that. Below is the rest of the info (including the observation about the UTF-16LE BOM). (continued from the stack overflow answer from K J) So perhaps this was a bug, "waiting to happen", only in such a rare combination! In order to correct for the bug, the colours should have been read as hex.
Then that be transferred in the merge. Answer |
When merging PDF containing images (one per page) some images were alterd in the resulting merged file.
The issue was discussed on stackoverflow here:
https://stackoverflow.com/questions/78508800/pypdf-does-not-give-me-the-right-image
where it was proposed to report this here.
The conclusion in the stackoverflow discussion was that (copying from the answer by K.J. on stackoverflow):
The image pixels have not changed, but the colour index has been incorrectly interpreted and rewritten in the merge.
The Source colours are written as an Octal literal string.
This has been mis-interpreted as a UTF-16 string and replaced with:
The net effect is all the colours are now bit rotten. Many, but not all, will look reversed from dark to light.
Environment
Which environment were you using when you encountered the problem?
Code + PDF
This is a minimal, complete example that shows the issue:
Share here the PDF file(s) that cause the issue. The smaller they are, the
better. Let us know if we may add them to our tests!
Note that it is the second page which is the problem.
original_before_merge.pdf
And the result I get from the above code is this:
after_merge.pdf
The text was updated successfully, but these errors were encountered: