[dvipdfmx] bug with inclusion of a PNG

Paulo Ney de Souza pauloney at gmail.com
Wed Jan 13 05:16:16 CET 2021


Dear Shunsaku,

Thank you for all the clarification. I was intrigued by the choice of using
the calibration data when including a file, and the first thing I did was
to see what everybody else were doing.

I did see that XeTeX has company in Libre Office, but that is about it. All
other programs I tried -- Adobe InDesign, Photoshop, Illustrator, MS Word,
MS Publisher do it just like pdfTeX and LuaTeX, and ignore the calibration
data on the PNG.

And on another point, reading the PNG specification (
http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html) I saw the following
text:

        An sRGB chunk or iCCP chunk, when present and recognized, overrides
the cHRM chunk.

that seems to imply the calibration chunk should be ignore in the presence
of an sRGB chunk -- which I believe is our case, isn't it?

Many thanks for your help in understanding this,
Paulo Ney


On Tue, Jan 12, 2021 at 8:10 AM 平田俊作 <shunsaku.hirata74 at gmail.com> wrote:

>
>
> 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/20210112/f0ceeb7b/attachment-0001.html>


More information about the dvipdfmx mailing list.