PDF colour model and LaTeX












124















(Strictly speaking, this is a question about XeLaTeX and the xcolor package but I’m assuming that the issue is actually with the color model of PDF.)



I’m having the problem that colours in my PDF don’t match. For example, I screen grabbed a colour value as RGB, declared it in my document and the resulting colour was completely different. To illustrate:



screenshot-1



Both colours were grabbed off the screen – on the left, from the PDF generated by XeLaTeX. On the right, the original colour whose RGB value I tried using in LaTeX (in case my issue isn’t clear: the colours on top are differnt, yet they have the same HSB values).



So I thought that perhaps RGB doesn’t map without loss to whatever colour model PDF used and tried the obvious alternative – CMYK, which, after all, is often used in print (right?). Again, the colours are off, but now less perceptibly.



Another example (this time using CMYK values):



screenshot-2



The colour is supposed to have the CMYK value (0.94, 0.63, 0.04, 0.07). I have declared the colour in my code as follows:



definecolor{primary}{cmyk}{0.94,0.63,0.04,0.07}


The bottom half of the picture is created by TikZ. The top half is actually an EPS that I included via includegraphics. The EPS was created in Inkscape. Neither of the above colours has the correct CMYK value when examined with a colour picker:



The top is (0.96, 0.67, 0.08, 0.19). The bottom is (0.92, 0.61, 0.06, 0.09).



(Incidentally, when I try to enter the “correct” CMYK value in Inkscape, it “auto-corrects” my value to some other value. Wut?)



Now, this mightn’t seem like a TeX related question at all. But, long story short,



How can I reliably reproduce colours in pdfLaTeX/XeLaTeX?





I know that the issue is confounded by the fact that PNG (which is the format of the above screenshots) uses an own colour model and so the screen shots may look different on your PC than on mine. But since I pasted the colours into the same image, I think that the difference should be preserved.










share|improve this question


















  • 2





    I have no clue about this, but it's funny that when I try to read the color from your first image (on OS X with the DigitalColor Meter) even on the “solid” area the values flicker when you move a bit up and down. (Edit: Ah, it's a jpg, that's why)

    – Juan A. Navarro
    Jan 31 '11 at 15:48








  • 1





    did you usepackage[dvipdfx,cmyk]{xcolor} ?

    – Herbert
    Jan 31 '11 at 15:59








  • 2





    According to the GIMP, the two colors in your first picture do not have the same HSV values, the first one has hue of 30, the second mostly 35 (with few spots of 34). I believe that in general, conversion between different color spaces is device dependent, so if you use different device profiles, you can get different results.

    – Jan Hlavacek
    Jan 31 '11 at 16:16






  • 1





    @Konrad: usepackage[xetex,...]{xcolor} is also supported by xcolor

    – Herbert
    Jan 31 '11 at 16:26






  • 4





    This question opens up a huge can of worms. Colour spaces are immensely complicated beasts: Even RGB and RGB be different things! There is sRGB, which is the standard colour profile for computer monitors, and there is Adobe RGB, which allows for a bigger gamut of colours (especially, more greens) and is more suited for photos. It is my understanding that one should avoid CMYK altogether unless the goal is to produce PDF for a specific printing press and paper whose characteristics are known.

    – Harald Hanche-Olsen
    Jan 31 '11 at 16:35
















124















(Strictly speaking, this is a question about XeLaTeX and the xcolor package but I’m assuming that the issue is actually with the color model of PDF.)



I’m having the problem that colours in my PDF don’t match. For example, I screen grabbed a colour value as RGB, declared it in my document and the resulting colour was completely different. To illustrate:



screenshot-1



Both colours were grabbed off the screen – on the left, from the PDF generated by XeLaTeX. On the right, the original colour whose RGB value I tried using in LaTeX (in case my issue isn’t clear: the colours on top are differnt, yet they have the same HSB values).



So I thought that perhaps RGB doesn’t map without loss to whatever colour model PDF used and tried the obvious alternative – CMYK, which, after all, is often used in print (right?). Again, the colours are off, but now less perceptibly.



Another example (this time using CMYK values):



screenshot-2



The colour is supposed to have the CMYK value (0.94, 0.63, 0.04, 0.07). I have declared the colour in my code as follows:



definecolor{primary}{cmyk}{0.94,0.63,0.04,0.07}


The bottom half of the picture is created by TikZ. The top half is actually an EPS that I included via includegraphics. The EPS was created in Inkscape. Neither of the above colours has the correct CMYK value when examined with a colour picker:



The top is (0.96, 0.67, 0.08, 0.19). The bottom is (0.92, 0.61, 0.06, 0.09).



(Incidentally, when I try to enter the “correct” CMYK value in Inkscape, it “auto-corrects” my value to some other value. Wut?)



Now, this mightn’t seem like a TeX related question at all. But, long story short,



How can I reliably reproduce colours in pdfLaTeX/XeLaTeX?





I know that the issue is confounded by the fact that PNG (which is the format of the above screenshots) uses an own colour model and so the screen shots may look different on your PC than on mine. But since I pasted the colours into the same image, I think that the difference should be preserved.










share|improve this question


















  • 2





    I have no clue about this, but it's funny that when I try to read the color from your first image (on OS X with the DigitalColor Meter) even on the “solid” area the values flicker when you move a bit up and down. (Edit: Ah, it's a jpg, that's why)

    – Juan A. Navarro
    Jan 31 '11 at 15:48








  • 1





    did you usepackage[dvipdfx,cmyk]{xcolor} ?

    – Herbert
    Jan 31 '11 at 15:59








  • 2





    According to the GIMP, the two colors in your first picture do not have the same HSV values, the first one has hue of 30, the second mostly 35 (with few spots of 34). I believe that in general, conversion between different color spaces is device dependent, so if you use different device profiles, you can get different results.

    – Jan Hlavacek
    Jan 31 '11 at 16:16






  • 1





    @Konrad: usepackage[xetex,...]{xcolor} is also supported by xcolor

    – Herbert
    Jan 31 '11 at 16:26






  • 4





    This question opens up a huge can of worms. Colour spaces are immensely complicated beasts: Even RGB and RGB be different things! There is sRGB, which is the standard colour profile for computer monitors, and there is Adobe RGB, which allows for a bigger gamut of colours (especially, more greens) and is more suited for photos. It is my understanding that one should avoid CMYK altogether unless the goal is to produce PDF for a specific printing press and paper whose characteristics are known.

    – Harald Hanche-Olsen
    Jan 31 '11 at 16:35














124












124








124


68






(Strictly speaking, this is a question about XeLaTeX and the xcolor package but I’m assuming that the issue is actually with the color model of PDF.)



I’m having the problem that colours in my PDF don’t match. For example, I screen grabbed a colour value as RGB, declared it in my document and the resulting colour was completely different. To illustrate:



screenshot-1



Both colours were grabbed off the screen – on the left, from the PDF generated by XeLaTeX. On the right, the original colour whose RGB value I tried using in LaTeX (in case my issue isn’t clear: the colours on top are differnt, yet they have the same HSB values).



So I thought that perhaps RGB doesn’t map without loss to whatever colour model PDF used and tried the obvious alternative – CMYK, which, after all, is often used in print (right?). Again, the colours are off, but now less perceptibly.



Another example (this time using CMYK values):



screenshot-2



The colour is supposed to have the CMYK value (0.94, 0.63, 0.04, 0.07). I have declared the colour in my code as follows:



definecolor{primary}{cmyk}{0.94,0.63,0.04,0.07}


The bottom half of the picture is created by TikZ. The top half is actually an EPS that I included via includegraphics. The EPS was created in Inkscape. Neither of the above colours has the correct CMYK value when examined with a colour picker:



The top is (0.96, 0.67, 0.08, 0.19). The bottom is (0.92, 0.61, 0.06, 0.09).



(Incidentally, when I try to enter the “correct” CMYK value in Inkscape, it “auto-corrects” my value to some other value. Wut?)



Now, this mightn’t seem like a TeX related question at all. But, long story short,



How can I reliably reproduce colours in pdfLaTeX/XeLaTeX?





I know that the issue is confounded by the fact that PNG (which is the format of the above screenshots) uses an own colour model and so the screen shots may look different on your PC than on mine. But since I pasted the colours into the same image, I think that the difference should be preserved.










share|improve this question














(Strictly speaking, this is a question about XeLaTeX and the xcolor package but I’m assuming that the issue is actually with the color model of PDF.)



I’m having the problem that colours in my PDF don’t match. For example, I screen grabbed a colour value as RGB, declared it in my document and the resulting colour was completely different. To illustrate:



screenshot-1



Both colours were grabbed off the screen – on the left, from the PDF generated by XeLaTeX. On the right, the original colour whose RGB value I tried using in LaTeX (in case my issue isn’t clear: the colours on top are differnt, yet they have the same HSB values).



So I thought that perhaps RGB doesn’t map without loss to whatever colour model PDF used and tried the obvious alternative – CMYK, which, after all, is often used in print (right?). Again, the colours are off, but now less perceptibly.



Another example (this time using CMYK values):



screenshot-2



The colour is supposed to have the CMYK value (0.94, 0.63, 0.04, 0.07). I have declared the colour in my code as follows:



definecolor{primary}{cmyk}{0.94,0.63,0.04,0.07}


The bottom half of the picture is created by TikZ. The top half is actually an EPS that I included via includegraphics. The EPS was created in Inkscape. Neither of the above colours has the correct CMYK value when examined with a colour picker:



The top is (0.96, 0.67, 0.08, 0.19). The bottom is (0.92, 0.61, 0.06, 0.09).



(Incidentally, when I try to enter the “correct” CMYK value in Inkscape, it “auto-corrects” my value to some other value. Wut?)



Now, this mightn’t seem like a TeX related question at all. But, long story short,



How can I reliably reproduce colours in pdfLaTeX/XeLaTeX?





I know that the issue is confounded by the fact that PNG (which is the format of the above screenshots) uses an own colour model and so the screen shots may look different on your PC than on mine. But since I pasted the colours into the same image, I think that the difference should be preserved.







pdf color






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 31 '11 at 15:37









Konrad RudolphKonrad Rudolph

26.9k1786140




26.9k1786140








  • 2





    I have no clue about this, but it's funny that when I try to read the color from your first image (on OS X with the DigitalColor Meter) even on the “solid” area the values flicker when you move a bit up and down. (Edit: Ah, it's a jpg, that's why)

    – Juan A. Navarro
    Jan 31 '11 at 15:48








  • 1





    did you usepackage[dvipdfx,cmyk]{xcolor} ?

    – Herbert
    Jan 31 '11 at 15:59








  • 2





    According to the GIMP, the two colors in your first picture do not have the same HSV values, the first one has hue of 30, the second mostly 35 (with few spots of 34). I believe that in general, conversion between different color spaces is device dependent, so if you use different device profiles, you can get different results.

    – Jan Hlavacek
    Jan 31 '11 at 16:16






  • 1





    @Konrad: usepackage[xetex,...]{xcolor} is also supported by xcolor

    – Herbert
    Jan 31 '11 at 16:26






  • 4





    This question opens up a huge can of worms. Colour spaces are immensely complicated beasts: Even RGB and RGB be different things! There is sRGB, which is the standard colour profile for computer monitors, and there is Adobe RGB, which allows for a bigger gamut of colours (especially, more greens) and is more suited for photos. It is my understanding that one should avoid CMYK altogether unless the goal is to produce PDF for a specific printing press and paper whose characteristics are known.

    – Harald Hanche-Olsen
    Jan 31 '11 at 16:35














  • 2





    I have no clue about this, but it's funny that when I try to read the color from your first image (on OS X with the DigitalColor Meter) even on the “solid” area the values flicker when you move a bit up and down. (Edit: Ah, it's a jpg, that's why)

    – Juan A. Navarro
    Jan 31 '11 at 15:48








  • 1





    did you usepackage[dvipdfx,cmyk]{xcolor} ?

    – Herbert
    Jan 31 '11 at 15:59








  • 2





    According to the GIMP, the two colors in your first picture do not have the same HSV values, the first one has hue of 30, the second mostly 35 (with few spots of 34). I believe that in general, conversion between different color spaces is device dependent, so if you use different device profiles, you can get different results.

    – Jan Hlavacek
    Jan 31 '11 at 16:16






  • 1





    @Konrad: usepackage[xetex,...]{xcolor} is also supported by xcolor

    – Herbert
    Jan 31 '11 at 16:26






  • 4





    This question opens up a huge can of worms. Colour spaces are immensely complicated beasts: Even RGB and RGB be different things! There is sRGB, which is the standard colour profile for computer monitors, and there is Adobe RGB, which allows for a bigger gamut of colours (especially, more greens) and is more suited for photos. It is my understanding that one should avoid CMYK altogether unless the goal is to produce PDF for a specific printing press and paper whose characteristics are known.

    – Harald Hanche-Olsen
    Jan 31 '11 at 16:35








2




2





I have no clue about this, but it's funny that when I try to read the color from your first image (on OS X with the DigitalColor Meter) even on the “solid” area the values flicker when you move a bit up and down. (Edit: Ah, it's a jpg, that's why)

– Juan A. Navarro
Jan 31 '11 at 15:48







I have no clue about this, but it's funny that when I try to read the color from your first image (on OS X with the DigitalColor Meter) even on the “solid” area the values flicker when you move a bit up and down. (Edit: Ah, it's a jpg, that's why)

– Juan A. Navarro
Jan 31 '11 at 15:48






1




1





did you usepackage[dvipdfx,cmyk]{xcolor} ?

– Herbert
Jan 31 '11 at 15:59







did you usepackage[dvipdfx,cmyk]{xcolor} ?

– Herbert
Jan 31 '11 at 15:59






2




2





According to the GIMP, the two colors in your first picture do not have the same HSV values, the first one has hue of 30, the second mostly 35 (with few spots of 34). I believe that in general, conversion between different color spaces is device dependent, so if you use different device profiles, you can get different results.

– Jan Hlavacek
Jan 31 '11 at 16:16





According to the GIMP, the two colors in your first picture do not have the same HSV values, the first one has hue of 30, the second mostly 35 (with few spots of 34). I believe that in general, conversion between different color spaces is device dependent, so if you use different device profiles, you can get different results.

– Jan Hlavacek
Jan 31 '11 at 16:16




1




1





@Konrad: usepackage[xetex,...]{xcolor} is also supported by xcolor

– Herbert
Jan 31 '11 at 16:26





@Konrad: usepackage[xetex,...]{xcolor} is also supported by xcolor

– Herbert
Jan 31 '11 at 16:26




4




4





This question opens up a huge can of worms. Colour spaces are immensely complicated beasts: Even RGB and RGB be different things! There is sRGB, which is the standard colour profile for computer monitors, and there is Adobe RGB, which allows for a bigger gamut of colours (especially, more greens) and is more suited for photos. It is my understanding that one should avoid CMYK altogether unless the goal is to produce PDF for a specific printing press and paper whose characteristics are known.

– Harald Hanche-Olsen
Jan 31 '11 at 16:35





This question opens up a huge can of worms. Colour spaces are immensely complicated beasts: Even RGB and RGB be different things! There is sRGB, which is the standard colour profile for computer monitors, and there is Adobe RGB, which allows for a bigger gamut of colours (especially, more greens) and is more suited for photos. It is my understanding that one should avoid CMYK altogether unless the goal is to produce PDF for a specific printing press and paper whose characteristics are known.

– Harald Hanche-Olsen
Jan 31 '11 at 16:35










2 Answers
2






active

oldest

votes


















142





+300









The colour model of PDF is extremely sophisticated and bewilderingly flexible. You can read all about it in section 8.6 of the pdf specification (you can download it here). There are a number of prepress tools that exist for managing a colourspace workflow with PDF. Adobe Acrobat Professional has an "output preview" tool which is what I use.



PDF supports many colour spaces: gray, cmyk, rgb, indexed, LAB, deviceN. This allows for things like spot colours (and tints thereof), special metallic or varnish inks, 6-colour printing, duotone, multitone, registration colours, and so on. You can have multiple such colour spaces within the same PDF (although for printing you'll need to convert to some common space, at least for each page). There can even be multiple variants of the same colour space family (for example sRGB and the variant of RGB that your scanner or digicam uses; cmyk with different dot gains, etc).



The situation gets even more complicated when you involve transparency (see section 11.7 of the spec): in order to overlay one object on another the PDF viewer needs to convert them to a common "blending" colour space, which can be specified in various ways in the PDF (including at the "page group" level: this explains why including transparency on a page can change the appearance of other objects on that page, because those objects now have to run through a colour space conversion). There are various restrictions and special cases, for example device colours cannot be converted reliably into CIE based spaces (such as sRGB). Since transparency groups can nest, there can be multiple rounds of colour space conversion during rendering.



TeX support



Now for latex support via xcolor: If you load xcolor with the (default) natural option there will be no colour space conversions, and you will have access to the PDF "DeviceRGB", "DeviceCMYK" and "DeviceGray" spaces. Eg, textcolor[rgb]{1,0,0}{DeviceRGB red}, and textcolor[cmyk]{0,1,1,0}{DeviceCMYK Red}. Your PDF viewer (for screen) or your printer driver (for hardcopy) will have to convert colour spaces if necessary. If you load xcolor with options like rgb or cmyk then xcolor will convert to that colour space, using the formulas from section 6.3 of the xcolor manual (which are not very sophisticated -- compare them to the formulas in 10.3 of the PDF spec, with BG(k) and UCR(k) functions, etc).



If you use the dvips route to producing PDF then you may be able to access also spot colours and other colour spaces, using the named and ps models. I believe Context makes these things somewhat easier, but I don't speak from experience.



Remember that converting device colour spaces to the screen colour space is in general not well defined, and different viewers may do it slightly differently, resulting in the mismatches you've observed.



One good solution with pdflatex is to use only deviceRGB (for screen) or deviceCMYK (for most printers) and then set an "Output Intent" to define the device space as, eg, sRGB IEC61966-2.1. See section 14.11.5 of the PDF spec. The pdfx package does this, for example (although that package is pretty rough around the edges and you'll generally need to edit it directly to get it to work). A more "proper" way to use calibrated colour spaces would be the "Default Color Spaces" mechanism (section 8.6.5.6) which specifies a way to remap DeviceRGB, DeviceCMYK, DeviceGray into device-independent CIE-based colour spaces. I'm not aware of any latex package that makes use of this PDF1.1 feature, though. (Grepping through the sources suggests that again Context may have some support for this).



The case of the different coloured swatches



In your first pair of images, note that the left image has a gray triangle in the upper right corner. This indicates that it is a deviceRGB colour from a screen grab. Click on the icon to the left of the "HSB Sliders" indicator and choose the colour space as for the right swatch, and you'll see that the colours will then match.



The case of inkscape "autocorrecting" CMYK



Perhaps this article will be helpful.






share|improve this answer





















  • 19





    This answer is awesome on so many levels. It gives a concise explanantion of (1) PDF colour models, (2) TeX support for colour models, (3) OS X colour support and the correct usage of the “Colors” dialog, which has somehow eluded me for years, and finally (4) a pointer to the bewildering behaviour of Inkscape. What can I say? Thanks a lot

    – Konrad Rudolph
    Jan 31 '11 at 20:46






  • 6





    @Alan: I will, but first I will wait two days and make this question a bounty. Then I can award more points for the answer.

    – Konrad Rudolph
    Feb 1 '11 at 7:50






  • 1





    Do I understand it right, that for example usepackage[cmyk]{xcolor} will convert all color definitions in the document that use another color model? sth like definecolor{halfblack}{gray}{0.5} would in the end be CMYK?

    – Gambhiro
    May 6 '11 at 7:41






  • 1





    By 'One good solution with pdflatex is to use only deviceRGB (for screen) or deviceCMYK (for most printers) and then set an "Output Intent" to define the device space as, eg, sRGB IEC61966-2.1.' do you mean that it's not generally a good idea to use the same PDF file for the screen and the print version of a document?

    – Christian
    Feb 24 '13 at 22:51






  • 1





    @Christian: yes, having separate screen and print versions gives the most control over colour, although such a level of control is rarely needed for most simple documents, in which case I would choose CMYK or RGB depending on the primary medium of the document. You only want complete control if you're at the level of worrying about rich blacks, trapping, and such things. (There may be other reasons, unrelated to colour, to have separate print and screen versions, such as doing away with recto/verso distinction for screen, adding a thumb index for print).

    – Lev Bishop
    Feb 25 '13 at 5:47



















1














Expanding on the following remark of Lev Bishop:




Remember that converting device colour spaces to the screen colour
space is in general not well defined, and different viewers may do it
slightly differently, resulting in the mismatches you've observed.




I noticed pdf viewer Evince does not render colors as specified. E.g., take the following document with grayscale boxes:



documentclass[10pt]{article}

usepackage[pdftex,rgb]{xcolor}
definecolor{gray0}{gray}{0}
definecolor{gray2}{gray}{0.2}
definecolor{gray5}{gray}{0.5}
definecolor{gray8}{gray}{0.8}
definecolor{gray10}{gray}{1}

begin{document}
%Draw grayscale boxes
frame{color{gray0}rule{2cm}{2cm}}
frame{color{gray2}rule{2cm}{2cm}}
frame{color{gray5}rule{2cm}{2cm}}
frame{color{gray8}rule{2cm}{2cm}}
frame{color{gray10}rule{2cm}{2cm}}
end{document}


Open the pdf with Evince and pick with Gpick yields:

0.09 (indeed, black text is not rendered as true black as in rgb(0, 0, 0))

0.27

0.54

0.81

0.99



Make a screenshot of the pdf, open with Gnome's Image Viewer:
The picked colors match the colors specified in Latex document.



Open the pdf with Adobe Reader and pick with Photoshop (on Windows) yields:
The picked colors match the colors specified in Latex document.



Open in Evince a pdf-document generated with LibreOffice and pick the text:
0.09 (again, black text is not rendered as true black as in rgb(0, 0, 0))



Conclusion: Evince or its pdf backend Poppler does not render colors as specified.



Rendering inconsistencies, unfortunately, seem to be part of all pdf viewers:
https://srg.doc.ic.ac.uk/projects/pdf-errors/results.html
https://link.springer.com/article/10.1007/s10664-018-9600-2



For the interested, details about how Evince renders colors:

Plot specified gray vs picked gray (using wolframalpha.com):

Plot[{0, 0.09}, {0.2,0.27}, {0.5,0.54}, {0.8,0.81}, {1,0.99}]
Inconsistent colors Evince

Fit a curve through the dataset:

Fit[{0, 0.09}, {0.2,0.27}, {0.5,0.54}, {0.8,0.81}, {1,0.99}]

A linear approximation comes very close: grayEvince = 0.9*graySpecified + 0.09

Conclusion: Evince (or Poppler) particularly renders dark colors too light. It maps the range [darkest,lightest] to [0.09,0.99] instead of [0,1]



Final request:
Can somebody pick the color black with Gpick in another Poppler-based pdf viewer? This way we can determine whether the rendering problem lies with Evince or Poppler.






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f9961%2fpdf-colour-model-and-latex%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    142





    +300









    The colour model of PDF is extremely sophisticated and bewilderingly flexible. You can read all about it in section 8.6 of the pdf specification (you can download it here). There are a number of prepress tools that exist for managing a colourspace workflow with PDF. Adobe Acrobat Professional has an "output preview" tool which is what I use.



    PDF supports many colour spaces: gray, cmyk, rgb, indexed, LAB, deviceN. This allows for things like spot colours (and tints thereof), special metallic or varnish inks, 6-colour printing, duotone, multitone, registration colours, and so on. You can have multiple such colour spaces within the same PDF (although for printing you'll need to convert to some common space, at least for each page). There can even be multiple variants of the same colour space family (for example sRGB and the variant of RGB that your scanner or digicam uses; cmyk with different dot gains, etc).



    The situation gets even more complicated when you involve transparency (see section 11.7 of the spec): in order to overlay one object on another the PDF viewer needs to convert them to a common "blending" colour space, which can be specified in various ways in the PDF (including at the "page group" level: this explains why including transparency on a page can change the appearance of other objects on that page, because those objects now have to run through a colour space conversion). There are various restrictions and special cases, for example device colours cannot be converted reliably into CIE based spaces (such as sRGB). Since transparency groups can nest, there can be multiple rounds of colour space conversion during rendering.



    TeX support



    Now for latex support via xcolor: If you load xcolor with the (default) natural option there will be no colour space conversions, and you will have access to the PDF "DeviceRGB", "DeviceCMYK" and "DeviceGray" spaces. Eg, textcolor[rgb]{1,0,0}{DeviceRGB red}, and textcolor[cmyk]{0,1,1,0}{DeviceCMYK Red}. Your PDF viewer (for screen) or your printer driver (for hardcopy) will have to convert colour spaces if necessary. If you load xcolor with options like rgb or cmyk then xcolor will convert to that colour space, using the formulas from section 6.3 of the xcolor manual (which are not very sophisticated -- compare them to the formulas in 10.3 of the PDF spec, with BG(k) and UCR(k) functions, etc).



    If you use the dvips route to producing PDF then you may be able to access also spot colours and other colour spaces, using the named and ps models. I believe Context makes these things somewhat easier, but I don't speak from experience.



    Remember that converting device colour spaces to the screen colour space is in general not well defined, and different viewers may do it slightly differently, resulting in the mismatches you've observed.



    One good solution with pdflatex is to use only deviceRGB (for screen) or deviceCMYK (for most printers) and then set an "Output Intent" to define the device space as, eg, sRGB IEC61966-2.1. See section 14.11.5 of the PDF spec. The pdfx package does this, for example (although that package is pretty rough around the edges and you'll generally need to edit it directly to get it to work). A more "proper" way to use calibrated colour spaces would be the "Default Color Spaces" mechanism (section 8.6.5.6) which specifies a way to remap DeviceRGB, DeviceCMYK, DeviceGray into device-independent CIE-based colour spaces. I'm not aware of any latex package that makes use of this PDF1.1 feature, though. (Grepping through the sources suggests that again Context may have some support for this).



    The case of the different coloured swatches



    In your first pair of images, note that the left image has a gray triangle in the upper right corner. This indicates that it is a deviceRGB colour from a screen grab. Click on the icon to the left of the "HSB Sliders" indicator and choose the colour space as for the right swatch, and you'll see that the colours will then match.



    The case of inkscape "autocorrecting" CMYK



    Perhaps this article will be helpful.






    share|improve this answer





















    • 19





      This answer is awesome on so many levels. It gives a concise explanantion of (1) PDF colour models, (2) TeX support for colour models, (3) OS X colour support and the correct usage of the “Colors” dialog, which has somehow eluded me for years, and finally (4) a pointer to the bewildering behaviour of Inkscape. What can I say? Thanks a lot

      – Konrad Rudolph
      Jan 31 '11 at 20:46






    • 6





      @Alan: I will, but first I will wait two days and make this question a bounty. Then I can award more points for the answer.

      – Konrad Rudolph
      Feb 1 '11 at 7:50






    • 1





      Do I understand it right, that for example usepackage[cmyk]{xcolor} will convert all color definitions in the document that use another color model? sth like definecolor{halfblack}{gray}{0.5} would in the end be CMYK?

      – Gambhiro
      May 6 '11 at 7:41






    • 1





      By 'One good solution with pdflatex is to use only deviceRGB (for screen) or deviceCMYK (for most printers) and then set an "Output Intent" to define the device space as, eg, sRGB IEC61966-2.1.' do you mean that it's not generally a good idea to use the same PDF file for the screen and the print version of a document?

      – Christian
      Feb 24 '13 at 22:51






    • 1





      @Christian: yes, having separate screen and print versions gives the most control over colour, although such a level of control is rarely needed for most simple documents, in which case I would choose CMYK or RGB depending on the primary medium of the document. You only want complete control if you're at the level of worrying about rich blacks, trapping, and such things. (There may be other reasons, unrelated to colour, to have separate print and screen versions, such as doing away with recto/verso distinction for screen, adding a thumb index for print).

      – Lev Bishop
      Feb 25 '13 at 5:47
















    142





    +300









    The colour model of PDF is extremely sophisticated and bewilderingly flexible. You can read all about it in section 8.6 of the pdf specification (you can download it here). There are a number of prepress tools that exist for managing a colourspace workflow with PDF. Adobe Acrobat Professional has an "output preview" tool which is what I use.



    PDF supports many colour spaces: gray, cmyk, rgb, indexed, LAB, deviceN. This allows for things like spot colours (and tints thereof), special metallic or varnish inks, 6-colour printing, duotone, multitone, registration colours, and so on. You can have multiple such colour spaces within the same PDF (although for printing you'll need to convert to some common space, at least for each page). There can even be multiple variants of the same colour space family (for example sRGB and the variant of RGB that your scanner or digicam uses; cmyk with different dot gains, etc).



    The situation gets even more complicated when you involve transparency (see section 11.7 of the spec): in order to overlay one object on another the PDF viewer needs to convert them to a common "blending" colour space, which can be specified in various ways in the PDF (including at the "page group" level: this explains why including transparency on a page can change the appearance of other objects on that page, because those objects now have to run through a colour space conversion). There are various restrictions and special cases, for example device colours cannot be converted reliably into CIE based spaces (such as sRGB). Since transparency groups can nest, there can be multiple rounds of colour space conversion during rendering.



    TeX support



    Now for latex support via xcolor: If you load xcolor with the (default) natural option there will be no colour space conversions, and you will have access to the PDF "DeviceRGB", "DeviceCMYK" and "DeviceGray" spaces. Eg, textcolor[rgb]{1,0,0}{DeviceRGB red}, and textcolor[cmyk]{0,1,1,0}{DeviceCMYK Red}. Your PDF viewer (for screen) or your printer driver (for hardcopy) will have to convert colour spaces if necessary. If you load xcolor with options like rgb or cmyk then xcolor will convert to that colour space, using the formulas from section 6.3 of the xcolor manual (which are not very sophisticated -- compare them to the formulas in 10.3 of the PDF spec, with BG(k) and UCR(k) functions, etc).



    If you use the dvips route to producing PDF then you may be able to access also spot colours and other colour spaces, using the named and ps models. I believe Context makes these things somewhat easier, but I don't speak from experience.



    Remember that converting device colour spaces to the screen colour space is in general not well defined, and different viewers may do it slightly differently, resulting in the mismatches you've observed.



    One good solution with pdflatex is to use only deviceRGB (for screen) or deviceCMYK (for most printers) and then set an "Output Intent" to define the device space as, eg, sRGB IEC61966-2.1. See section 14.11.5 of the PDF spec. The pdfx package does this, for example (although that package is pretty rough around the edges and you'll generally need to edit it directly to get it to work). A more "proper" way to use calibrated colour spaces would be the "Default Color Spaces" mechanism (section 8.6.5.6) which specifies a way to remap DeviceRGB, DeviceCMYK, DeviceGray into device-independent CIE-based colour spaces. I'm not aware of any latex package that makes use of this PDF1.1 feature, though. (Grepping through the sources suggests that again Context may have some support for this).



    The case of the different coloured swatches



    In your first pair of images, note that the left image has a gray triangle in the upper right corner. This indicates that it is a deviceRGB colour from a screen grab. Click on the icon to the left of the "HSB Sliders" indicator and choose the colour space as for the right swatch, and you'll see that the colours will then match.



    The case of inkscape "autocorrecting" CMYK



    Perhaps this article will be helpful.






    share|improve this answer





















    • 19





      This answer is awesome on so many levels. It gives a concise explanantion of (1) PDF colour models, (2) TeX support for colour models, (3) OS X colour support and the correct usage of the “Colors” dialog, which has somehow eluded me for years, and finally (4) a pointer to the bewildering behaviour of Inkscape. What can I say? Thanks a lot

      – Konrad Rudolph
      Jan 31 '11 at 20:46






    • 6





      @Alan: I will, but first I will wait two days and make this question a bounty. Then I can award more points for the answer.

      – Konrad Rudolph
      Feb 1 '11 at 7:50






    • 1





      Do I understand it right, that for example usepackage[cmyk]{xcolor} will convert all color definitions in the document that use another color model? sth like definecolor{halfblack}{gray}{0.5} would in the end be CMYK?

      – Gambhiro
      May 6 '11 at 7:41






    • 1





      By 'One good solution with pdflatex is to use only deviceRGB (for screen) or deviceCMYK (for most printers) and then set an "Output Intent" to define the device space as, eg, sRGB IEC61966-2.1.' do you mean that it's not generally a good idea to use the same PDF file for the screen and the print version of a document?

      – Christian
      Feb 24 '13 at 22:51






    • 1





      @Christian: yes, having separate screen and print versions gives the most control over colour, although such a level of control is rarely needed for most simple documents, in which case I would choose CMYK or RGB depending on the primary medium of the document. You only want complete control if you're at the level of worrying about rich blacks, trapping, and such things. (There may be other reasons, unrelated to colour, to have separate print and screen versions, such as doing away with recto/verso distinction for screen, adding a thumb index for print).

      – Lev Bishop
      Feb 25 '13 at 5:47














    142





    +300







    142





    +300



    142




    +300





    The colour model of PDF is extremely sophisticated and bewilderingly flexible. You can read all about it in section 8.6 of the pdf specification (you can download it here). There are a number of prepress tools that exist for managing a colourspace workflow with PDF. Adobe Acrobat Professional has an "output preview" tool which is what I use.



    PDF supports many colour spaces: gray, cmyk, rgb, indexed, LAB, deviceN. This allows for things like spot colours (and tints thereof), special metallic or varnish inks, 6-colour printing, duotone, multitone, registration colours, and so on. You can have multiple such colour spaces within the same PDF (although for printing you'll need to convert to some common space, at least for each page). There can even be multiple variants of the same colour space family (for example sRGB and the variant of RGB that your scanner or digicam uses; cmyk with different dot gains, etc).



    The situation gets even more complicated when you involve transparency (see section 11.7 of the spec): in order to overlay one object on another the PDF viewer needs to convert them to a common "blending" colour space, which can be specified in various ways in the PDF (including at the "page group" level: this explains why including transparency on a page can change the appearance of other objects on that page, because those objects now have to run through a colour space conversion). There are various restrictions and special cases, for example device colours cannot be converted reliably into CIE based spaces (such as sRGB). Since transparency groups can nest, there can be multiple rounds of colour space conversion during rendering.



    TeX support



    Now for latex support via xcolor: If you load xcolor with the (default) natural option there will be no colour space conversions, and you will have access to the PDF "DeviceRGB", "DeviceCMYK" and "DeviceGray" spaces. Eg, textcolor[rgb]{1,0,0}{DeviceRGB red}, and textcolor[cmyk]{0,1,1,0}{DeviceCMYK Red}. Your PDF viewer (for screen) or your printer driver (for hardcopy) will have to convert colour spaces if necessary. If you load xcolor with options like rgb or cmyk then xcolor will convert to that colour space, using the formulas from section 6.3 of the xcolor manual (which are not very sophisticated -- compare them to the formulas in 10.3 of the PDF spec, with BG(k) and UCR(k) functions, etc).



    If you use the dvips route to producing PDF then you may be able to access also spot colours and other colour spaces, using the named and ps models. I believe Context makes these things somewhat easier, but I don't speak from experience.



    Remember that converting device colour spaces to the screen colour space is in general not well defined, and different viewers may do it slightly differently, resulting in the mismatches you've observed.



    One good solution with pdflatex is to use only deviceRGB (for screen) or deviceCMYK (for most printers) and then set an "Output Intent" to define the device space as, eg, sRGB IEC61966-2.1. See section 14.11.5 of the PDF spec. The pdfx package does this, for example (although that package is pretty rough around the edges and you'll generally need to edit it directly to get it to work). A more "proper" way to use calibrated colour spaces would be the "Default Color Spaces" mechanism (section 8.6.5.6) which specifies a way to remap DeviceRGB, DeviceCMYK, DeviceGray into device-independent CIE-based colour spaces. I'm not aware of any latex package that makes use of this PDF1.1 feature, though. (Grepping through the sources suggests that again Context may have some support for this).



    The case of the different coloured swatches



    In your first pair of images, note that the left image has a gray triangle in the upper right corner. This indicates that it is a deviceRGB colour from a screen grab. Click on the icon to the left of the "HSB Sliders" indicator and choose the colour space as for the right swatch, and you'll see that the colours will then match.



    The case of inkscape "autocorrecting" CMYK



    Perhaps this article will be helpful.






    share|improve this answer















    The colour model of PDF is extremely sophisticated and bewilderingly flexible. You can read all about it in section 8.6 of the pdf specification (you can download it here). There are a number of prepress tools that exist for managing a colourspace workflow with PDF. Adobe Acrobat Professional has an "output preview" tool which is what I use.



    PDF supports many colour spaces: gray, cmyk, rgb, indexed, LAB, deviceN. This allows for things like spot colours (and tints thereof), special metallic or varnish inks, 6-colour printing, duotone, multitone, registration colours, and so on. You can have multiple such colour spaces within the same PDF (although for printing you'll need to convert to some common space, at least for each page). There can even be multiple variants of the same colour space family (for example sRGB and the variant of RGB that your scanner or digicam uses; cmyk with different dot gains, etc).



    The situation gets even more complicated when you involve transparency (see section 11.7 of the spec): in order to overlay one object on another the PDF viewer needs to convert them to a common "blending" colour space, which can be specified in various ways in the PDF (including at the "page group" level: this explains why including transparency on a page can change the appearance of other objects on that page, because those objects now have to run through a colour space conversion). There are various restrictions and special cases, for example device colours cannot be converted reliably into CIE based spaces (such as sRGB). Since transparency groups can nest, there can be multiple rounds of colour space conversion during rendering.



    TeX support



    Now for latex support via xcolor: If you load xcolor with the (default) natural option there will be no colour space conversions, and you will have access to the PDF "DeviceRGB", "DeviceCMYK" and "DeviceGray" spaces. Eg, textcolor[rgb]{1,0,0}{DeviceRGB red}, and textcolor[cmyk]{0,1,1,0}{DeviceCMYK Red}. Your PDF viewer (for screen) or your printer driver (for hardcopy) will have to convert colour spaces if necessary. If you load xcolor with options like rgb or cmyk then xcolor will convert to that colour space, using the formulas from section 6.3 of the xcolor manual (which are not very sophisticated -- compare them to the formulas in 10.3 of the PDF spec, with BG(k) and UCR(k) functions, etc).



    If you use the dvips route to producing PDF then you may be able to access also spot colours and other colour spaces, using the named and ps models. I believe Context makes these things somewhat easier, but I don't speak from experience.



    Remember that converting device colour spaces to the screen colour space is in general not well defined, and different viewers may do it slightly differently, resulting in the mismatches you've observed.



    One good solution with pdflatex is to use only deviceRGB (for screen) or deviceCMYK (for most printers) and then set an "Output Intent" to define the device space as, eg, sRGB IEC61966-2.1. See section 14.11.5 of the PDF spec. The pdfx package does this, for example (although that package is pretty rough around the edges and you'll generally need to edit it directly to get it to work). A more "proper" way to use calibrated colour spaces would be the "Default Color Spaces" mechanism (section 8.6.5.6) which specifies a way to remap DeviceRGB, DeviceCMYK, DeviceGray into device-independent CIE-based colour spaces. I'm not aware of any latex package that makes use of this PDF1.1 feature, though. (Grepping through the sources suggests that again Context may have some support for this).



    The case of the different coloured swatches



    In your first pair of images, note that the left image has a gray triangle in the upper right corner. This indicates that it is a deviceRGB colour from a screen grab. Click on the icon to the left of the "HSB Sliders" indicator and choose the colour space as for the right swatch, and you'll see that the colours will then match.



    The case of inkscape "autocorrecting" CMYK



    Perhaps this article will be helpful.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited May 9 '11 at 4:05

























    answered Jan 31 '11 at 20:14









    Lev BishopLev Bishop

    37k694150




    37k694150








    • 19





      This answer is awesome on so many levels. It gives a concise explanantion of (1) PDF colour models, (2) TeX support for colour models, (3) OS X colour support and the correct usage of the “Colors” dialog, which has somehow eluded me for years, and finally (4) a pointer to the bewildering behaviour of Inkscape. What can I say? Thanks a lot

      – Konrad Rudolph
      Jan 31 '11 at 20:46






    • 6





      @Alan: I will, but first I will wait two days and make this question a bounty. Then I can award more points for the answer.

      – Konrad Rudolph
      Feb 1 '11 at 7:50






    • 1





      Do I understand it right, that for example usepackage[cmyk]{xcolor} will convert all color definitions in the document that use another color model? sth like definecolor{halfblack}{gray}{0.5} would in the end be CMYK?

      – Gambhiro
      May 6 '11 at 7:41






    • 1





      By 'One good solution with pdflatex is to use only deviceRGB (for screen) or deviceCMYK (for most printers) and then set an "Output Intent" to define the device space as, eg, sRGB IEC61966-2.1.' do you mean that it's not generally a good idea to use the same PDF file for the screen and the print version of a document?

      – Christian
      Feb 24 '13 at 22:51






    • 1





      @Christian: yes, having separate screen and print versions gives the most control over colour, although such a level of control is rarely needed for most simple documents, in which case I would choose CMYK or RGB depending on the primary medium of the document. You only want complete control if you're at the level of worrying about rich blacks, trapping, and such things. (There may be other reasons, unrelated to colour, to have separate print and screen versions, such as doing away with recto/verso distinction for screen, adding a thumb index for print).

      – Lev Bishop
      Feb 25 '13 at 5:47














    • 19





      This answer is awesome on so many levels. It gives a concise explanantion of (1) PDF colour models, (2) TeX support for colour models, (3) OS X colour support and the correct usage of the “Colors” dialog, which has somehow eluded me for years, and finally (4) a pointer to the bewildering behaviour of Inkscape. What can I say? Thanks a lot

      – Konrad Rudolph
      Jan 31 '11 at 20:46






    • 6





      @Alan: I will, but first I will wait two days and make this question a bounty. Then I can award more points for the answer.

      – Konrad Rudolph
      Feb 1 '11 at 7:50






    • 1





      Do I understand it right, that for example usepackage[cmyk]{xcolor} will convert all color definitions in the document that use another color model? sth like definecolor{halfblack}{gray}{0.5} would in the end be CMYK?

      – Gambhiro
      May 6 '11 at 7:41






    • 1





      By 'One good solution with pdflatex is to use only deviceRGB (for screen) or deviceCMYK (for most printers) and then set an "Output Intent" to define the device space as, eg, sRGB IEC61966-2.1.' do you mean that it's not generally a good idea to use the same PDF file for the screen and the print version of a document?

      – Christian
      Feb 24 '13 at 22:51






    • 1





      @Christian: yes, having separate screen and print versions gives the most control over colour, although such a level of control is rarely needed for most simple documents, in which case I would choose CMYK or RGB depending on the primary medium of the document. You only want complete control if you're at the level of worrying about rich blacks, trapping, and such things. (There may be other reasons, unrelated to colour, to have separate print and screen versions, such as doing away with recto/verso distinction for screen, adding a thumb index for print).

      – Lev Bishop
      Feb 25 '13 at 5:47








    19




    19





    This answer is awesome on so many levels. It gives a concise explanantion of (1) PDF colour models, (2) TeX support for colour models, (3) OS X colour support and the correct usage of the “Colors” dialog, which has somehow eluded me for years, and finally (4) a pointer to the bewildering behaviour of Inkscape. What can I say? Thanks a lot

    – Konrad Rudolph
    Jan 31 '11 at 20:46





    This answer is awesome on so many levels. It gives a concise explanantion of (1) PDF colour models, (2) TeX support for colour models, (3) OS X colour support and the correct usage of the “Colors” dialog, which has somehow eluded me for years, and finally (4) a pointer to the bewildering behaviour of Inkscape. What can I say? Thanks a lot

    – Konrad Rudolph
    Jan 31 '11 at 20:46




    6




    6





    @Alan: I will, but first I will wait two days and make this question a bounty. Then I can award more points for the answer.

    – Konrad Rudolph
    Feb 1 '11 at 7:50





    @Alan: I will, but first I will wait two days and make this question a bounty. Then I can award more points for the answer.

    – Konrad Rudolph
    Feb 1 '11 at 7:50




    1




    1





    Do I understand it right, that for example usepackage[cmyk]{xcolor} will convert all color definitions in the document that use another color model? sth like definecolor{halfblack}{gray}{0.5} would in the end be CMYK?

    – Gambhiro
    May 6 '11 at 7:41





    Do I understand it right, that for example usepackage[cmyk]{xcolor} will convert all color definitions in the document that use another color model? sth like definecolor{halfblack}{gray}{0.5} would in the end be CMYK?

    – Gambhiro
    May 6 '11 at 7:41




    1




    1





    By 'One good solution with pdflatex is to use only deviceRGB (for screen) or deviceCMYK (for most printers) and then set an "Output Intent" to define the device space as, eg, sRGB IEC61966-2.1.' do you mean that it's not generally a good idea to use the same PDF file for the screen and the print version of a document?

    – Christian
    Feb 24 '13 at 22:51





    By 'One good solution with pdflatex is to use only deviceRGB (for screen) or deviceCMYK (for most printers) and then set an "Output Intent" to define the device space as, eg, sRGB IEC61966-2.1.' do you mean that it's not generally a good idea to use the same PDF file for the screen and the print version of a document?

    – Christian
    Feb 24 '13 at 22:51




    1




    1





    @Christian: yes, having separate screen and print versions gives the most control over colour, although such a level of control is rarely needed for most simple documents, in which case I would choose CMYK or RGB depending on the primary medium of the document. You only want complete control if you're at the level of worrying about rich blacks, trapping, and such things. (There may be other reasons, unrelated to colour, to have separate print and screen versions, such as doing away with recto/verso distinction for screen, adding a thumb index for print).

    – Lev Bishop
    Feb 25 '13 at 5:47





    @Christian: yes, having separate screen and print versions gives the most control over colour, although such a level of control is rarely needed for most simple documents, in which case I would choose CMYK or RGB depending on the primary medium of the document. You only want complete control if you're at the level of worrying about rich blacks, trapping, and such things. (There may be other reasons, unrelated to colour, to have separate print and screen versions, such as doing away with recto/verso distinction for screen, adding a thumb index for print).

    – Lev Bishop
    Feb 25 '13 at 5:47











    1














    Expanding on the following remark of Lev Bishop:




    Remember that converting device colour spaces to the screen colour
    space is in general not well defined, and different viewers may do it
    slightly differently, resulting in the mismatches you've observed.




    I noticed pdf viewer Evince does not render colors as specified. E.g., take the following document with grayscale boxes:



    documentclass[10pt]{article}

    usepackage[pdftex,rgb]{xcolor}
    definecolor{gray0}{gray}{0}
    definecolor{gray2}{gray}{0.2}
    definecolor{gray5}{gray}{0.5}
    definecolor{gray8}{gray}{0.8}
    definecolor{gray10}{gray}{1}

    begin{document}
    %Draw grayscale boxes
    frame{color{gray0}rule{2cm}{2cm}}
    frame{color{gray2}rule{2cm}{2cm}}
    frame{color{gray5}rule{2cm}{2cm}}
    frame{color{gray8}rule{2cm}{2cm}}
    frame{color{gray10}rule{2cm}{2cm}}
    end{document}


    Open the pdf with Evince and pick with Gpick yields:

    0.09 (indeed, black text is not rendered as true black as in rgb(0, 0, 0))

    0.27

    0.54

    0.81

    0.99



    Make a screenshot of the pdf, open with Gnome's Image Viewer:
    The picked colors match the colors specified in Latex document.



    Open the pdf with Adobe Reader and pick with Photoshop (on Windows) yields:
    The picked colors match the colors specified in Latex document.



    Open in Evince a pdf-document generated with LibreOffice and pick the text:
    0.09 (again, black text is not rendered as true black as in rgb(0, 0, 0))



    Conclusion: Evince or its pdf backend Poppler does not render colors as specified.



    Rendering inconsistencies, unfortunately, seem to be part of all pdf viewers:
    https://srg.doc.ic.ac.uk/projects/pdf-errors/results.html
    https://link.springer.com/article/10.1007/s10664-018-9600-2



    For the interested, details about how Evince renders colors:

    Plot specified gray vs picked gray (using wolframalpha.com):

    Plot[{0, 0.09}, {0.2,0.27}, {0.5,0.54}, {0.8,0.81}, {1,0.99}]
    Inconsistent colors Evince

    Fit a curve through the dataset:

    Fit[{0, 0.09}, {0.2,0.27}, {0.5,0.54}, {0.8,0.81}, {1,0.99}]

    A linear approximation comes very close: grayEvince = 0.9*graySpecified + 0.09

    Conclusion: Evince (or Poppler) particularly renders dark colors too light. It maps the range [darkest,lightest] to [0.09,0.99] instead of [0,1]



    Final request:
    Can somebody pick the color black with Gpick in another Poppler-based pdf viewer? This way we can determine whether the rendering problem lies with Evince or Poppler.






    share|improve this answer






























      1














      Expanding on the following remark of Lev Bishop:




      Remember that converting device colour spaces to the screen colour
      space is in general not well defined, and different viewers may do it
      slightly differently, resulting in the mismatches you've observed.




      I noticed pdf viewer Evince does not render colors as specified. E.g., take the following document with grayscale boxes:



      documentclass[10pt]{article}

      usepackage[pdftex,rgb]{xcolor}
      definecolor{gray0}{gray}{0}
      definecolor{gray2}{gray}{0.2}
      definecolor{gray5}{gray}{0.5}
      definecolor{gray8}{gray}{0.8}
      definecolor{gray10}{gray}{1}

      begin{document}
      %Draw grayscale boxes
      frame{color{gray0}rule{2cm}{2cm}}
      frame{color{gray2}rule{2cm}{2cm}}
      frame{color{gray5}rule{2cm}{2cm}}
      frame{color{gray8}rule{2cm}{2cm}}
      frame{color{gray10}rule{2cm}{2cm}}
      end{document}


      Open the pdf with Evince and pick with Gpick yields:

      0.09 (indeed, black text is not rendered as true black as in rgb(0, 0, 0))

      0.27

      0.54

      0.81

      0.99



      Make a screenshot of the pdf, open with Gnome's Image Viewer:
      The picked colors match the colors specified in Latex document.



      Open the pdf with Adobe Reader and pick with Photoshop (on Windows) yields:
      The picked colors match the colors specified in Latex document.



      Open in Evince a pdf-document generated with LibreOffice and pick the text:
      0.09 (again, black text is not rendered as true black as in rgb(0, 0, 0))



      Conclusion: Evince or its pdf backend Poppler does not render colors as specified.



      Rendering inconsistencies, unfortunately, seem to be part of all pdf viewers:
      https://srg.doc.ic.ac.uk/projects/pdf-errors/results.html
      https://link.springer.com/article/10.1007/s10664-018-9600-2



      For the interested, details about how Evince renders colors:

      Plot specified gray vs picked gray (using wolframalpha.com):

      Plot[{0, 0.09}, {0.2,0.27}, {0.5,0.54}, {0.8,0.81}, {1,0.99}]
      Inconsistent colors Evince

      Fit a curve through the dataset:

      Fit[{0, 0.09}, {0.2,0.27}, {0.5,0.54}, {0.8,0.81}, {1,0.99}]

      A linear approximation comes very close: grayEvince = 0.9*graySpecified + 0.09

      Conclusion: Evince (or Poppler) particularly renders dark colors too light. It maps the range [darkest,lightest] to [0.09,0.99] instead of [0,1]



      Final request:
      Can somebody pick the color black with Gpick in another Poppler-based pdf viewer? This way we can determine whether the rendering problem lies with Evince or Poppler.






      share|improve this answer




























        1












        1








        1







        Expanding on the following remark of Lev Bishop:




        Remember that converting device colour spaces to the screen colour
        space is in general not well defined, and different viewers may do it
        slightly differently, resulting in the mismatches you've observed.




        I noticed pdf viewer Evince does not render colors as specified. E.g., take the following document with grayscale boxes:



        documentclass[10pt]{article}

        usepackage[pdftex,rgb]{xcolor}
        definecolor{gray0}{gray}{0}
        definecolor{gray2}{gray}{0.2}
        definecolor{gray5}{gray}{0.5}
        definecolor{gray8}{gray}{0.8}
        definecolor{gray10}{gray}{1}

        begin{document}
        %Draw grayscale boxes
        frame{color{gray0}rule{2cm}{2cm}}
        frame{color{gray2}rule{2cm}{2cm}}
        frame{color{gray5}rule{2cm}{2cm}}
        frame{color{gray8}rule{2cm}{2cm}}
        frame{color{gray10}rule{2cm}{2cm}}
        end{document}


        Open the pdf with Evince and pick with Gpick yields:

        0.09 (indeed, black text is not rendered as true black as in rgb(0, 0, 0))

        0.27

        0.54

        0.81

        0.99



        Make a screenshot of the pdf, open with Gnome's Image Viewer:
        The picked colors match the colors specified in Latex document.



        Open the pdf with Adobe Reader and pick with Photoshop (on Windows) yields:
        The picked colors match the colors specified in Latex document.



        Open in Evince a pdf-document generated with LibreOffice and pick the text:
        0.09 (again, black text is not rendered as true black as in rgb(0, 0, 0))



        Conclusion: Evince or its pdf backend Poppler does not render colors as specified.



        Rendering inconsistencies, unfortunately, seem to be part of all pdf viewers:
        https://srg.doc.ic.ac.uk/projects/pdf-errors/results.html
        https://link.springer.com/article/10.1007/s10664-018-9600-2



        For the interested, details about how Evince renders colors:

        Plot specified gray vs picked gray (using wolframalpha.com):

        Plot[{0, 0.09}, {0.2,0.27}, {0.5,0.54}, {0.8,0.81}, {1,0.99}]
        Inconsistent colors Evince

        Fit a curve through the dataset:

        Fit[{0, 0.09}, {0.2,0.27}, {0.5,0.54}, {0.8,0.81}, {1,0.99}]

        A linear approximation comes very close: grayEvince = 0.9*graySpecified + 0.09

        Conclusion: Evince (or Poppler) particularly renders dark colors too light. It maps the range [darkest,lightest] to [0.09,0.99] instead of [0,1]



        Final request:
        Can somebody pick the color black with Gpick in another Poppler-based pdf viewer? This way we can determine whether the rendering problem lies with Evince or Poppler.






        share|improve this answer















        Expanding on the following remark of Lev Bishop:




        Remember that converting device colour spaces to the screen colour
        space is in general not well defined, and different viewers may do it
        slightly differently, resulting in the mismatches you've observed.




        I noticed pdf viewer Evince does not render colors as specified. E.g., take the following document with grayscale boxes:



        documentclass[10pt]{article}

        usepackage[pdftex,rgb]{xcolor}
        definecolor{gray0}{gray}{0}
        definecolor{gray2}{gray}{0.2}
        definecolor{gray5}{gray}{0.5}
        definecolor{gray8}{gray}{0.8}
        definecolor{gray10}{gray}{1}

        begin{document}
        %Draw grayscale boxes
        frame{color{gray0}rule{2cm}{2cm}}
        frame{color{gray2}rule{2cm}{2cm}}
        frame{color{gray5}rule{2cm}{2cm}}
        frame{color{gray8}rule{2cm}{2cm}}
        frame{color{gray10}rule{2cm}{2cm}}
        end{document}


        Open the pdf with Evince and pick with Gpick yields:

        0.09 (indeed, black text is not rendered as true black as in rgb(0, 0, 0))

        0.27

        0.54

        0.81

        0.99



        Make a screenshot of the pdf, open with Gnome's Image Viewer:
        The picked colors match the colors specified in Latex document.



        Open the pdf with Adobe Reader and pick with Photoshop (on Windows) yields:
        The picked colors match the colors specified in Latex document.



        Open in Evince a pdf-document generated with LibreOffice and pick the text:
        0.09 (again, black text is not rendered as true black as in rgb(0, 0, 0))



        Conclusion: Evince or its pdf backend Poppler does not render colors as specified.



        Rendering inconsistencies, unfortunately, seem to be part of all pdf viewers:
        https://srg.doc.ic.ac.uk/projects/pdf-errors/results.html
        https://link.springer.com/article/10.1007/s10664-018-9600-2



        For the interested, details about how Evince renders colors:

        Plot specified gray vs picked gray (using wolframalpha.com):

        Plot[{0, 0.09}, {0.2,0.27}, {0.5,0.54}, {0.8,0.81}, {1,0.99}]
        Inconsistent colors Evince

        Fit a curve through the dataset:

        Fit[{0, 0.09}, {0.2,0.27}, {0.5,0.54}, {0.8,0.81}, {1,0.99}]

        A linear approximation comes very close: grayEvince = 0.9*graySpecified + 0.09

        Conclusion: Evince (or Poppler) particularly renders dark colors too light. It maps the range [darkest,lightest] to [0.09,0.99] instead of [0,1]



        Final request:
        Can somebody pick the color black with Gpick in another Poppler-based pdf viewer? This way we can determine whether the rendering problem lies with Evince or Poppler.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 7 at 15:02

























        answered Mar 7 at 14:43









        BartBart

        858




        858






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f9961%2fpdf-colour-model-and-latex%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to send String Array data to Server using php in android

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Is anime1.com a legal site for watching anime?