Skip to content

Commit

Permalink
Merge pull request #19327 from Snuffleupagus/issue-19326
Browse files Browse the repository at this point in the history
Access the number of components correctly in JPEG 2000 images with color space entries (issue 19326)
  • Loading branch information
Snuffleupagus authored Jan 15, 2025
2 parents 016de74 + e5bc760 commit 2533a08
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ class PDFImage {
this.numComps = this.colorSpace.numComps;

if (this.jpxDecoderOptions) {
this.jpxDecoderOptions.numComponents = hasColorSpace ? this.numComp : 0;
this.jpxDecoderOptions.numComponents = hasColorSpace
? this.numComps
: 0;
// If the jpx image has a color space then it musn't be used in order to
// be able to use the color space that comes from the pdf.
this.jpxDecoderOptions.isIndexedColormap =
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@
!bug1743245.pdf
!quadpoints.pdf
!transparent.pdf
!issue19326.pdf
!issue13931.pdf
!xobject-image.pdf
!issue15441.pdf
Expand Down
Binary file added test/pdfs/issue19326.pdf
Binary file not shown.
7 changes: 7 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6364,6 +6364,13 @@
"type": "eq",
"about": "Fixes one part of bug 1731483."
},
{
"id": "issue19326",
"file": "pdfs/issue19326.pdf",
"md5": "b4d937017daf439a6318501428e0c6ba",
"rounds": 1,
"type": "eq"
},
{
"id": "bug1140761",
"file": "pdfs/bug1140761.pdf",
Expand Down

0 comments on commit 2533a08

Please sign in to comment.