PNG Images with FlateDecode are corrupt
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.7k
- Forks
- 579
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
I try to extract all XObject (images) from the test pdf
test.pdf
Only the not "FlateDecode" jpg are correct decoded (raw jpg data).
the other images are just 0x00... or 0xFF... byte garbage,
I think maybe the plain gzuncompress
call is not enough and the DecodeParms
/DecodeParms << /Predictor 15 /Colors 1 /Columns 1200 /BitsPerComponent 8>>
must be respected too.
I found this old piece of code https://github.com/frapi/frapi/blob/ef50192b6cf336ef2c4c0fc3ad122194e3d0ecde/src/frapi/library/Zend/Pdf/Filter/Compression.php
but without any success.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/Smalot/PdfParser/RawData/FilterHelper.php around the gzuncompress call referenced by the issue, then inspect how DecodeParms are handled for FlateDecode streams. Use the linked test.pdf to reproduce extraction and verify that the affected XObject images are no longer returned as 0x00 or 0xFF byte garbage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100