[dvipdfmx] bug with inclusion of a PNG

Shunsaku Hirata shunsaku.hirata74 at gmail.com
Tue Jan 12 15:36:51 CET 2021


Sorry there is a correction.

2021年1月12日(火) 21:10 Shunsaku Hirata <shunsaku.hirata74 at gmail.com>:
>
> Hi Paulo,
>
> Your PNG images A.png and B.png actually use a calibrated color space
> as specified in gAMA and cHRM chunks of PNG images. Hence CalRGB
> should be used.

This is correct.

> Colors specified in the DeviceRGB color space may look differently on
> different devices.  Indeed, your color.pdf doesn't show a color difference on
> my smartphone whereas it does on my laptop screen.

This is wrong. I was checking a different file.

Further inspecting it I found that the calibrated color space used in the
provided PNG files seems to be using an approximated sRGB space.
This seems to be causing a subtle difference in the color.

> If this is not as you intended, please remove the PNG chunks mentioned
> above.

I think dvipdfmx output is correct and I suggest doing the above.


Thanks,
Shunsaku Hirata

> 2021年1月12日(火) 10:56 Paulo Ney de Souza <pauloney at gmail.com>:
> >
> > 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
> >
> >
> >
> >
> >



More information about the dvipdfmx mailing list.