parallax / jsPDF

Client-side JavaScript PDF generation for everyone.
https://parall.ax/products/jspdf
MIT License
29.34k stars 4.68k forks source link

Set Document Color Space to sRGB (Not DeviceRGB) #2630

Open stirtingale opened 4 years ago

stirtingale commented 4 years ago

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 )

github-actions[bot] commented 4 years ago

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

stirtingale commented 4 years ago

Still relevant.

JeBuSBrian commented 3 years ago

This has become relevant to me as well. I use jsPDF to generate image-heavy documents. It's becoming apparent that without the color profiles, end-users are not always seeing the same thing.

If example documents would be helpful, I can provide a few.

adrienpicard commented 6 months ago

This is still relevant using 2.5.1. There is a slight colour shift when adding sRGB images to the document, even with embedded ICC profiles.