Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
P
poppler
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 613
    • Issues 613
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 39
    • Merge Requests 39
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • poppler
  • poppler
  • Issues
  • #920

Closed
Open
Opened May 27, 2020 by Štěpán Procházka@prochazka.stepan

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 #000042 color).

  • generating PDF file using xelatex (optional) test.tex
xelatex test.tex
  • converting pdf to png (no aliasing, transparent background) test.pdf
pdftocairo -transp -r 300 -antialias none -png test.pdf test

test-1

Observations

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 (rg and RG tags).

TEX value PDF value PNG value
07 0.027 06
08 0.031 07
09 0.035 08
0a 0.039 09
14 0.078 13
15 0.082 14
ea 0.918 eb
eb 0.922 ec
f5 0.961 f6
f6 0.965 f7
f7 0.969 f8
f8 0.973 f9

xelatex seems to convert RGB 0-255 color component c using sprintf(_, '%.3f', (c / 255.0)). The conflicting values are symmetrical (07-15 correspond to f8-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 🍰 for someone well oriented in the codebase.

NB: my pdftocairo version is 0.62.0, reading the changelog I did not found any change in newer versions relating to this issue.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: poppler/poppler#920