[dvipdfmx] bug with inclusion of a PNG

Paulo Ney de Souza pauloney at gmail.com
Tue Jan 12 00:28:45 CET 2021


I have (a couple) of PNG images with a background color of, for example,
RGB(80,64,83), that when placed on a page of the same background color with
`graphicx` -- they show a distinct tonality against the background -- which
is of the same color, when run under XeLaTeX. There are no problems under
pdfLaTeX or LuaLaTeX.

----
\documentclass{report}

\usepackage{xcolor}
\definecolor{bgcolor}{RGB}{80,64,83}

\usepackage{graphicx}
\pagestyle{empty}

\begin{document}

\pagecolor{bgcolor}
\includegraphics[width=0.5\textwidth]{A.png}
\quad
\includegraphics[width=0.5\textwidth]{B.png}

\medskip

\includegraphics[width=0.5\textwidth]{A-gimp.png}
\quad
\includegraphics[width=0.5\textwidth]{B-gimp.png}

\end{document}
---

Checking the colors in the included files one can see they have changed
from (80,64,83) to (71,56,74) in the first two included images.

Just opening the images on `GIMP` and exporting it as-is with the default
choices, fixes everything and the new inclusion now gets the exact color
they were set to begin with, the same as the background, as shown below
(second line).

Looking at the PDF, Ultike Fischer (at TeXHax) traced it to a problem with
dvipdfmx that, she determined, uses the wrong color space (CalRGB) for the
first two images and DeviceRGB for the last two.

What is that XeTeX needs from the PNG's to preserve their color when
included in a page?

For experimentation here are all files attached.

Paulo Ney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/dvipdfmx/attachments/20210111/7b270fa2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: color.tex
Type: text/x-tex
Size: 390 bytes
Desc: not available
URL: <https://tug.org/pipermail/dvipdfmx/attachments/20210111/7b270fa2/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: color.pdf
Type: application/pdf
Size: 10039 bytes
Desc: not available
URL: <https://tug.org/pipermail/dvipdfmx/attachments/20210111/7b270fa2/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: A-gimp.png
Type: image/png
Size: 190 bytes
Desc: not available
URL: <https://tug.org/pipermail/dvipdfmx/attachments/20210111/7b270fa2/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: export-settings.png
Type: image/png
Size: 44605 bytes
Desc: not available
URL: <https://tug.org/pipermail/dvipdfmx/attachments/20210111/7b270fa2/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: B-gimp.png
Type: image/png
Size: 4025 bytes
Desc: not available
URL: <https://tug.org/pipermail/dvipdfmx/attachments/20210111/7b270fa2/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: B.png
Type: image/png
Size: 4584 bytes
Desc: not available
URL: <https://tug.org/pipermail/dvipdfmx/attachments/20210111/7b270fa2/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: A.png
Type: image/png
Size: 340 bytes
Desc: not available
URL: <https://tug.org/pipermail/dvipdfmx/attachments/20210111/7b270fa2/attachment-0009.png>


More information about the dvipdfmx mailing list.