question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CMYK images converted to RGB

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 5.3.1
  • Platform / OS version: macOS 10.15.7
  • URLs (if applicable):
  • Node.js version: 12.16.1

What steps will reproduce the problem?

Please include code that reproduces the issue.

// give puppeteer access to file
const express = require('express')
const app = express()
app.use(express.static(__dirname))
app.listen(3000)

// generate pdf
const puppeteer = require('puppeteer')
const html = `
<html>
    <body>
        <img src="http://localhost:3000/Channel_digital_image_CMYK_color.jpg">
    </body>    
</html>`
;(async () => {
    const browser = await puppeteer.launch()
    const page = await browser.newPage()
    await page.setContent(html)
    await page.pdf({ path: 'output.pdf' });
    console.log('done')
})()

Here is the CMYK image I used: https://upload.wikimedia.org/wikipedia/en/2/25/Channel_digital_image_CMYK_color.jpg

What is the expected result? If I extract the image from the resulting pdf, it will remain in CMYK format.

What happens instead? The image is converted to RGB, causing the PDF colors to be wrong when printed.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8

github_iconTop GitHub Comments

2reactions
anrecommented, Nov 30, 2020

At the moment we are pre-calculating the RGB values using the same ICC color profile as our print-service and only use this RGB colors in our application.

Are you generating a pdf with puppeteer and and then running it through Ghostscript afterwards? The image will technically be CMYK, but they will not match the colors of the CMYK image in the initial HTML file.

We also tried Ghostscript but as you say it will not be the same as the original picture and it is very slow.

1reaction
AdamGaskinscommented, Nov 30, 2020

Me too, we also need PDFs with CMYK colors for printing

now I’m using Ghostscript to convert pdf RGB to CMYK for printing

Are you generating a pdf with puppeteer and and then running it through Ghostscript afterwards? The image will technically be CMYK, but they will not match the colors of the CMYK image in the initial HTML file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Online CMYK to RGB conversion
Convert images from CMYK to RGB color space (using professional color profiles) with this free online converter.
Read more >
Online RGB to CMYK conversion
Convert images from RGB to the CMYK color space (using a professional ICC profile) with this free online converter.
Read more >
Convert CMYK to RGB online for free - Imageconvert.org
This tool is for converting from CMYK to RGB online without damaging the quality of resultant image.Our CMYK to RGB converter tool is...
Read more >
How To Convert Images From CMYK To RGB Mode In ...
With the file open, go to Image>Mode and select RGB Color. You will see an on-screen prompt telling you to flatten the image...
Read more >
Convert between color modes in Photoshop - Adobe Support
Learn how to use Adobe Photoshop to convert an image from one color mode to another, such as CMYK to RGB or color...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found