pdftocairo inconsistent color rendering
I am bumping into the issue of certain colors being changed during conversion (colors in resulting png differ from original pdf).
Steps to reproduce
Test file contains three sets of hex numbers (one set for each color component), each number is written in respective color (e.g.
42 in blue paragraph has
- generating PDF file using
- converting pdf to png (no aliasing, transparent background) test.pdf
pdftocairo -transp -r 300 -antialias none -png test.pdf test
Most of the colors are rendered correctly, only the following colors with specific value of any of the component cause the issue. I have inspected the contents of PDF and looked for stroke and fill color values (
|TEX value||PDF value||PNG value|
xelatex seems to convert RGB 0-255 color component
sprintf(_, '%.3f', (c / 255.0)). The conflicting values are symmetrical (
15 correspond to
ea). Eventhough the value in PDF is not the exactly the original one i would expect the converted color to be closest match - i.e. the correct color.
I was unable to trace the whole conversion code and potential origin of the issue in poppler library. Hope it will be
NB: my pdftocairo version is 0.62.0, reading the changelog I did not found any change in newer versions relating to this issue.