Color changing under graphic inclusion with graphicx

Paulo Ney de Souza pauloney at gmail.com
Sat Jan 9 21:08:34 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.

````
\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 included images.

Just opening the images on `GIMP` and exporting it as-is with the default
choices of

[image: export-settings.png]

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).


[image: together.png]

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

Paulo Ney


PS. For experimentation here are the same images, before and after opening
with GIMP.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20210109/8edc17fa/attachment-0001.html>
-------------- 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/texhax/attachments/20210109/8edc17fa/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: together.png
Type: image/png
Size: 15136 bytes
Desc: not available
URL: <https://tug.org/pipermail/texhax/attachments/20210109/8edc17fa/attachment-0007.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/texhax/attachments/20210109/8edc17fa/attachment-0008.png>
-------------- 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/texhax/attachments/20210109/8edc17fa/attachment-0009.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/texhax/attachments/20210109/8edc17fa/attachment-0010.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/texhax/attachments/20210109/8edc17fa/attachment-0011.png>


More information about the texhax mailing list.