TransWikia.com

CMYK image being converted to RGB

Stack Overflow Asked by Entity on December 22, 2020

Here’s the code I’m using, but its basically just a standard puppeteer usage with default settings, adding one CMYK image:

// 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')
})()

And here’s the CMYK image I’m using: https://upload.wikimedia.org/wikipedia/en/2/25/Channel_digital_image_CMYK_color.jpg

The problem is that the image is converted to RGB in the resulting PDF, causing the print to have the wrong colors. Is there some option in puppeteer or headless chrome to put the image bytes directly into the PDF without modification?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP