[dvipdfmx] bug with inclusion of a PNG

平田俊作 shunsaku.hirata74 at gmail.com
Tue Jan 12 17:09:56 CET 2021



> 2021/01/13 0:05、Paulo Ney de Souza <pauloney at gmail.com>のメール:
> 
> 
> Thanks Shunsaku, I am sorry I have more questions that on the first e-mail...
> 
>> On Tue, Jan 12, 2021 at 6:37 AM Shunsaku Hirata <shunsaku.hirata74 at gmail.com> wrote:
>> 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.
> 
> What do you use for checking the ColorSpace of an image?

This time I just used TweakPNG program to inspect the PNG files. I don’t know if there is any tool which can be used to check the color space of images in general.

>> > 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.
> 
> I think that now it isincorrect. The file "color.pdf" as processed by xelatex under TL'20
> show differences in tonality on laptops and tvs, but not on phones. 
> 
>  
>> 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.
> 
> Would you mind go into a bit more detail? The differences in color are completely 
> gone after one opens and export it in GIMP. How is GIMP able to calculate the 
> correct color? THat ought to be part of the original image, no?

This is because GIMP removed the color calibration information originally stored. I think the correct color was not calculated but the calibration information was simply ignored and was omitted when the image was exported.

Although your original PNG files contain some extra information which is required for reproducing the same color across different devices, PNG files exported by GIMP only contain RGB values with no associated information required for color calibration.

As you have specified the background color as device dependent RGB color values and now GIMP exported PNG also uses the same color specifications, the color must look exactly the same as long as the same RGB values are specified.

>  
>> 
>> > 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.
> 
> Would you mind go into a bit more detail here as well? If dvipdfmx is correct here then 
> latex,  pdflatex and lualatex are wrong.

I think pdflatex and lualatex don’t fully support  color calibration information in PNG format and ignore such information as in GIMP export.

The problem occurs because dvipdfmx tries to preserve the color calibration information stored in PNG files and uses device independent color space CalRGB for images while the background color is specified in the device dependent DeviceRGB color space.


Thanks,
Shunsaku Hirata
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/dvipdfmx/attachments/20210113/fe51b434/attachment.html>


More information about the dvipdfmx mailing list.