parallax/jsPDF

Set Document Color Space to sRGB (Not DeviceRGB)

Open

#2,630 opened on Dec 10, 2019

View on GitHub
 (4 comments) (0 reactions) (0 assignees)JavaScript (4,596 forks)batch import
Feature Requestdifficulty:mediumhacktoberfest

Repository metrics

Stars
 (28,280 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Expected behaviour -

I am using doc.addImage to create PDF photography portfolios on the fly.

doc.addImage($img[0], 'JPEG', $xfoffset, $yfoffset, $img[1], $img[2], null, 'NONE')

Images are formatted for web (sRGB) and also have embedded sRGB colour profiles.

PDF output should return colour accurate images.

**Actual Behaviour - **

Instead of images within the document are treated as if they do not have a colourspace associated with them.

Colour shifts quite a bit on a calibrated screen (see below; calibrated for Adobe 1998). Reds are oversaturated which is what I would expect for it reading a generic ICC profile

Screenshot 2019-12-10 at 12 55 06

Colour shift is more modest on a normal screen though.

Replicate

The production version of PDF output is @ https://www.tombarnes.com/lightbox/ (you can add images to the gallery from the rest of the site to generate the PDF).

Bug

I can't find specific documentation to set the output document as anything other than DeviceRGB?

I can see a few CYMK issues but these look to related to text or images assets being added to the document.

The reason I have added this as a bug rather than a question is that ICC should remain attached to images or stored in the PDF/X output intent area of the PDF file rather than be dropped on creation ( assuming that is what is happening )

Contributor guide