Skip to content

ROB: Clarify CMYK comment and detect image format from Pillow instead of guessing#3902

Open
BiswasNehaa wants to merge 2 commits into
py-pdf:mainfrom
BiswasNehaa:fix-3869-image-xobject-comments
Open

ROB: Clarify CMYK comment and detect image format from Pillow instead of guessing#3902
BiswasNehaa wants to merge 2 commits into
py-pdf:mainfrom
BiswasNehaa:fix-3869-image-xobject-comments

Conversation

@BiswasNehaa

Copy link
Copy Markdown

This covers two of three items in #3869 (CMYK comment + LZW/ASCII85 logic ). Skipped the ICC one.

CMYK: The old comment there pointed to a closed pair with no information. Pillow only got Native CMYK Palette support in v10.1.0, pypdf supports back to 8.0 .0 so the work around stays.

LZW/ASCII85: switched to opening the image first and trusting Pillow's actual detected format, instead of guessing from the filter type ...this is what j-t-1 suggested in the issue thread. Kept the old guess as a fallback for when Pillow can't read it at all.

tested: ran the image test suite, same pass rate as before my change; checked the two real fixture PDFs that hit this code give identical output before/after.

Used Claude to help investigate the Pillow version history and verify the diff.

@BiswasNehaa BiswasNehaa changed the title Clarify stale comments in image XObject handling (#3869) ROB: Clarify CMYK comment and detect image format from Pillow instead of guessing Jun 26, 2026
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.84%. Comparing base (efc511b) to head (81c4851).

Files with missing lines Patch % Lines
pypdf/generic/_image_xobject.py 71.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3902      +/-   ##
==========================================
- Coverage   97.86%   97.84%   -0.02%     
==========================================
  Files          57       57              
  Lines       10738    10740       +2     
  Branches     2006     2006              
==========================================
  Hits        10509    10509              
- Misses        127      129       +2     
  Partials      102      102              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@BiswasNehaa BiswasNehaa force-pushed the fix-3869-image-xobject-comments branch from 6f2f50c to 81c4851 Compare June 26, 2026 06:47
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.

1 participant