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 embedded CMYK image #415

Merged
merged 3 commits into from
Apr 26, 2020
Merged

Fix embedded CMYK image #415

merged 3 commits into from
Apr 26, 2020

Conversation

zwaldowski
Copy link
Contributor

Fixes two issues with the embedding of JPEG images in CMYK.

  • Images would not be visible in the output document at all. This is because pdf-lib would give it the DeviceCYMK space, apparently a transposition. PDF 32000-1:2008, Section 8.6.3 confirms the spelling DeviceCMYK.
  • Once they would appear, images would be inverted. This seems to be due to a difference between CMYK JPEG files on disk and streams in PDF. See code comment in PR for more detail (with one caveat).

Before

PDF
Input

Screen Shot 2020-04-21 at 2 05 47 AM

After

PDF
Input

Screen Shot 2020-04-21 at 2 07 19 AM

@Hopding
Copy link
Owner

Hopding commented Apr 26, 2020

This looks great. Thank you very much @zwaldowski!

P.S. I love the caveat meme. If we're honest, do any of us really have any idea what we're doing? 😂

@Hopding Hopding merged commit 594fc6a into Hopding:master Apr 26, 2020
@Hopding
Copy link
Owner

Hopding commented Apr 26, 2020

Version 1.5.0 is now published. It contains this fix. The full release notes are available here.

You can install this new version with npm:

npm install pdf-lib@1.5.0

It's also available on unpkg:

As well as jsDelivr:

Hopding pushed a commit that referenced this pull request Aug 30, 2021
* Fix embedded CMYK image rendering blank

* Fix embedded CMYK image rendering inverted

* Add test for CMYK embedding
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.

2 participants