[XeTeX] strange case of overlapping graphics

Zdenek Wagner zdenek.wagner at gmail.com
Fri Jun 11 11:48:09 CEST 2021


pá 11. 6. 2021 v 2:48 odesílatel Heiko Oberdiek via XeTeX
<xetex at tug.org> napsal:
>
> Hello,
>
> the properties of the PNG file "Zaborowski_MBC_page19y42_a.png"
> are (retrieved by display from ImageMagicks):
>
>    png:IHDR.width=112 pixels
>    png:IHDR.height=42 pixels
>    png:pHYs.x_res=984 pixels/m ≈ 25 dpi
>    png:pHYs.y_res=276 pixels/m ≈  7 dpi
>
> The image has different resolutions in the x- and y-directions.
> The final image size is:
>    width  ≈ 113.8 mm ≈ 4.48 in
>    height ≈ 152.2 mm ≈ 5.99 in
>
> The TeX compilers pdfTeX and LuaTeX correctly handle the image size.
> However, there is a bug in the XeTeX pipeline, the dimensions are
> correctly calculated (extractbb), but the image is embedded with
> the same resolution in both directions.
>
> I assume that the image looks distorted with pdfTeX. That means

Yes, if you review my post, this is what I saw after running it
through pdftex and Phil saw the same distorsion using his viewers. I
remember dot matrix and even laser printers with different direction,
one HP LaserJet had 300 dpi vertically and 600 dpi horizontally. This
is the reason to support different resolutions in different directions
but I am not aware of any nowaday's printer with such properties. I
would suggest not to set x- and y- resolutions to different values.

> the different resolutions in the pHYs PNG chunk is wrong.
> You can fix this in Gimp --> Menu --> Image --> Scale Image:
> Set the same physical resolution value to both the "X resolution"
> and the "Y resolution". Some math:
>
>    3ex = 12.91663 pt = 42 pixels / resolution
>
>    resolution = (42 pixels / 12.91663 pt)   ≈ 3.25 pixels / pt
>               * (72.27 pt / 1 in)           ≈ 235 pixels / in   [= dpi]
>               * (1 in / 25.4 mm)            ≈ 9.2518 pixels / mm
>
> Do *NOT* change the width or height. This would cause scaling
> the image data with the quality settings.
>    If only the resolution settings are changed, the image data
> are kept intact when the "Scale" button is pressed.
> Then the scaling operation only changes the resolution values
> for the images that are used, when the image is exported.
>
> Export the image as PNG with "Save resolution" enabled.
>
> Then, the new image can be used with pdfTeX, LuaTeX, and XeTeX.
> Since the x- and y-resolutions are the same, the bug of XeTeX
> is avoided.
>
> Yours sincerely
>    Heiko


Zdeněk Wagner
http://ttsm.icpf.cas.cz/team/wagner.shtml



More information about the XeTeX mailing list.