Re: [XeTeX] strange case of overlapping graphics

2021-08-09 Thread Ross Moore
Hello Sej.

This message came through empty to me.

Was it intentional?
How can we help you resolve the difficulty?


All the best.

Ross

On 8 Aug 2021, at 6:26 am, Sej Lyn Jimenez 
mailto:sejlynjime...@gmail.com>> wrote:



Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.mo...@mq.edu.au
http://www.maths.mq.edu.au
[cid:image001.png@01D030BE.D37A46F0]
CRICOS Provider Number 2J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. 




Re: [XeTeX] strange case of overlapping graphics

2021-08-07 Thread Sej Lyn Jimenez



Re: [XeTeX] strange case of overlapping graphics

2021-06-11 Thread Zdenek Wagner
pá 11. 6. 2021 v 2:48 odesílatel Heiko Oberdiek via XeTeX
 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



Re: [XeTeX] strange case of overlapping graphics - the summary

2021-06-10 Thread Janusz S. Bień


Thank you very much for all the informations and comments!

The culprit is definitely ddjvu:

https://sourceforge.net/p/djvu/bugs/335/

Fortunately the output in the ppm format is correct, so after converting
to png I can use it in my text.

Once again thank you very much for you quick reaction to my problem!

Best regards

Janusz

-- 
 ,   
Janusz S. Bien
emeryt (emeritus)
https://sites.google.com/view/jsbien


Re: [XeTeX] strange case of overlapping graphics

2021-06-10 Thread Heiko Oberdiek via XeTeX

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


Re: [XeTeX] strange case of overlapping graphics

2021-06-10 Thread Ross Moore
Hi Zdenek,

On 11 Jun 2021, at 6:49 am, Zdenek Wagner 
mailto:zdenek.wag...@gmail.com>> wrote:

Yes, it is what I saw in pdflatex as well. Now I see the reason, I have not 
read my exiftool output carefully. It says:

X Resolution: 25
Y Resolution: 7

Yes, that does look a bit weird, doesn’t it.
One would expect it to be the same in both directions, unless specifically
set to be different for a special effect.

Notice that it also saysResolution Unit: inches .
Surely not!  unless it needs ~100 units for the inch.
Further down there are  Pixel units of meters.
Very strange.

Thanks in advance for any lessons on how to properly read/interpret this info.

So the culprit need not be XeTeX after all.


All the best.

Ross


So, pdftex as well as viewers used by Phil honour the resolution in both 
directions and the output is tall. Gwenview, gimp and ocular just honour the 
size in pixels. Xelatex probably calculates the dimensions correctly taking 
into account X/Y resolutions, generated the commands for PNG inclusion but 
xdvipdfmx honours the pixels only, not the resolutions.

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


čt 10. 6. 2021 v 22:37 odesílatel Ross Moore 
mailto:ross.mo...@mq.edu.au>> napsal:
Hi Janusz, and others

For me, using  pdftex, the only issue is that the aspect ratio isn’t correct.

XeTeX gets it wrong:


Notice the apparent lack of centering with respect to the caption.
It’s as if the width has been read incorrectly by XeTeX, for positioning
the 2 instances of the image.



Explicitly specifying a more realistic width fixes this, with both engines.
Examining the information in GraphicConverter  (on MacOS)
I cannot see anything amiss.  (see image)




So to me, this looks like a XeTeX issue after all.


Hope this helps.

Ross


On 11 Jun 2021, at 2:12 am, Janusz S. Bień 
mailto:jsb...@mimuw.edu.pl>> wrote:

On Thu, Jun 10 2021 at 11:04 -05, Herbert Schulz wrote:
>> On Jun 10, 2021, at 10:58 AM, Zdenek Wagner 
>> mailto:zdenek.wag...@gmail.com>> wrote:
>>
>> čt 10. 6. 2021 v 17:09 odesílatel Philip Taylor
>> mailto:p.tay...@hellenic-institute.uk>> 
>> napsal:
>>>
>>> In both Windows Preview and in Adobe Illustrator CC, the PNG file
>>> is roughly twice as tall (relative to its width) as it appears in
>>> the PDF.
>>> --
>> So this means that the PNG contains something strange which is
>> interpreted by some programs and ignored by other programs. Maybe
>> different vertical and horizontal resolutions? I do not have a tool to
>> analyze it further.

Tomorrow I will make more tests and submit the problem to ddjvu
author(s).

> Howdy,
>
> And
>
> \includegraphics[width=1.3cm]{Zaborowski_MBC_page19y42_a}
> \includegraphics[width=1.3cm]{Zaborowski_MBC_page19y42_a}
>
> works fine (not exactly the same size but that can be adjusted).

Yes. It's great you have found a way to circumvent the problem!

On the other hand this make the problem more misterious...

Best regards

Janusz

--
,
Janusz S. Bien
emeryt (emeritus)
https://sites.google.com/view/jsbien


Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.mo...@mq.edu.au
http://www.maths.mq.edu.au

CRICOS Provider Number 2J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. 




Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.mo...@mq.edu.au
http://www.maths.mq.edu.au
[cid:image001.png@01D030BE.D37A46F0]
CRICOS Provider Number 2J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. 




Re: [XeTeX] strange case of overlapping graphics

2021-06-10 Thread Janusz S. Bień
On Thu, Jun 10 2021 at 11:04 -05, Herbert Schulz wrote:
>> On Jun 10, 2021, at 10:58 AM, Zdenek Wagner  wrote:
>> 
>> čt 10. 6. 2021 v 17:09 odesílatel Philip Taylor
>>  napsal:
>>> 
>>> In both Windows Preview and in Adobe Illustrator CC, the PNG file
>>> is roughly twice as tall (relative to its width) as it appears in
>>> the PDF.
>>> --
>> So this means that the PNG contains something strange which is
>> interpreted by some programs and ignored by other programs. Maybe
>> different vertical and horizontal resolutions? I do not have a tool to
>> analyze it further.

Tomorrow I will make more tests and submit the problem to ddjvu
author(s).

> Howdy,
>
> And
>
> \includegraphics[width=1.3cm]{Zaborowski_MBC_page19y42_a}
> \includegraphics[width=1.3cm]{Zaborowski_MBC_page19y42_a}
>
> works fine (not exactly the same size but that can be adjusted).

Yes. It's great you have found a way to circumvent the problem!

On the other hand this make the problem more misterious...

Best regards

Janusz

-- 
 ,   
Janusz S. Bien
emeryt (emeritus)
https://sites.google.com/view/jsbien



Re: [XeTeX] strange case of overlapping graphics

2021-06-10 Thread Herbert Schulz



> On Jun 10, 2021, at 10:58 AM, Zdenek Wagner  wrote:
> 
> čt 10. 6. 2021 v 17:09 odesílatel Philip Taylor
>  napsal:
>> 
>> In both Windows Preview and in Adobe Illustrator CC, the PNG file is roughly 
>> twice as tall (relative to its width) as it appears in the PDF.
>> --
> So this means that the PNG contains something strange which is
> interpreted by some programs and ignored by other programs. Maybe
> different vertical and horizontal resolutions? I do not have a tool to
> analyze it further.
> 
>> Philip Taylor
> 
> 
> Zdeněk Wagner
> http://ttsm.icpf.cas.cz/team/wagner.shtml
> 

Howdy,

And

\includegraphics[width=1.3cm]{Zaborowski_MBC_page19y42_a}
\includegraphics[width=1.3cm]{Zaborowski_MBC_page19y42_a}

works fine (not exactly the same size but that can be adjusted).

Good Luck,

Herb Schulz
he...@wideopenwest.com





Re: [XeTeX] strange case of overlapping graphics

2021-06-10 Thread Zdenek Wagner
čt 10. 6. 2021 v 17:09 odesílatel Philip Taylor
 napsal:
>
> In both Windows Preview and in Adobe Illustrator CC, the PNG file is roughly 
> twice as tall (relative to its width) as it appears in the PDF.
> --
So this means that the PNG contains something strange which is
interpreted by some programs and ignored by other programs. Maybe
different vertical and horizontal resolutions? I do not have a tool to
analyze it further.

> Philip Taylor


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



Re: [XeTeX] strange case of overlapping graphics

2021-06-10 Thread Philip Taylor
In both Windows Preview and in Adobe Illustrator CC, the PNG file is 
roughly twice as tall (relative to its width) as it appears in the PDF.

--
/Philip Taylor/


Re: [XeTeX] strange case of overlapping graphics

2021-06-10 Thread Janusz S. Bień
On Thu, Jun 10 2021 at 10:40 -04, Michael Maxwell wrote:
 There is no overlapping if pdflatex ix used but the images
 are distorted,
>
> If it's the case that s.t. is wrong with the image (and okular,
> gwenview and gimp are compensating somehow), could you import the
> image into one of these other programs, then export it from there?

As I said, the enclosed file was exported from Gimp. The same problem
occurs when the original TIFF is converted with Imagemagick.

If ddjvu is the culprit, then it does something so strange that the
problem survives conversions and import/exports.

Best regards

Janusz

-- 
 ,   
Janusz S. Bien
emeryt (emeritus)
https://sites.google.com/view/jsbien


Re: [XeTeX] strange case of overlapping graphics

2021-06-10 Thread Michael Maxwell

>>> There is no overlapping if pdflatex ix used but the images
>>> are distorted,

If it's the case that s.t. is wrong with the image (and okular, gwenview 
and gimp are compensating somehow), could you import the image into one 
of these other programs, then export it from there?


On 6/10/2021 10:35 AM, Janusz S. Bień wrote:

On Thu, Jun 10 2021 at 16:23 +02, Zdenek Wagner wrote:

Yes, there is something strange. I can reproduce the behaviour with
xelatex.


I prefer to stick to xelatex.


There is no overlapping if pdflatex ix used but the images
are distorted, see my result (after additional pdfcrop to remove the
white space on the page).


ddjvu can generate pdf directly, but the results are distorted in a very
similar way...


The picture itself looks fine in okular, gwenview as well as in gimp,
both "file" and "exiftool" show the right dimensions.



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


On Thu, Jun 10 2021 at  9:26 -05, Herbert Schulz wrote:

[...]


Howdy,

Also note that removing the height option from the first image will put the 
images side by side.


Yes, I can reproduce this.

Best regards

Janusz



--
Mike Maxwell
"Digital objects last forever--or five years,
whichever comes first."  --Jeff Rothenberg


Re: [XeTeX] strange case of overlapping graphics

2021-06-10 Thread Janusz S. Bień
On Thu, Jun 10 2021 at 16:23 +02, Zdenek Wagner wrote:
> Yes, there is something strange. I can reproduce the behaviour with
> xelatex.

I prefer to stick to xelatex.

> There is no overlapping if pdflatex ix used but the images
> are distorted, see my result (after additional pdfcrop to remove the
> white space on the page).

ddjvu can generate pdf directly, but the results are distorted in a very
similar way...

> The picture itself looks fine in okular, gwenview as well as in gimp,
> both "file" and "exiftool" show the right dimensions.

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

On Thu, Jun 10 2021 at  9:26 -05, Herbert Schulz wrote:

[...]

> Howdy,
>
> Also note that removing the height option from the first image will put the 
> images side by side.

Yes, I can reproduce this.

Best regards

Janusz

-- 
 ,   
Janusz S. Bien
emeryt (emeritus)
https://sites.google.com/view/jsbien



Re: [XeTeX] strange case of overlapping graphics

2021-06-10 Thread Herbert Schulz



> On Jun 10, 2021, at 9:04 AM, Janusz S. Bień  wrote:
> 
> 
> Hi!
> 
> Please have a look at the enclosed example.
> 
> I suspect there is something wrong with the graphic file although no
> tool reports any problem.
> 
> The file was exported from Gimp, the source was a TIFF file created by
> little known and little used ddjvu program (I used it for the first time
> just now).
> 
> I will appreciate your help.
> 
> Best regards
> 
> Janusz
> 
> 
> 
> -- 
> ,   
> Janusz S. Bien
> emeryt (emeritus)
> https://sites.google.com/view/jsbien

Howdy,

Also note that removing the height option from the first image will put the 
images side by side.

Good Luck,

Herb Schulz
he...@wideopenwest.com





Re: [XeTeX] strange case of overlapping graphics

2021-06-10 Thread Zdenek Wagner
Yes, there is something strange. I can reproduce the behaviour with
xelatex. There is no overlapping if pdflatex ix used but the images
are distorted, see my result (after additional pdfcrop to remove the
white space on the page). The picture itself looks fine in okular,
gwenview as well as in gimp, both "file" and "exiftool" show the right
dimensions.

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

čt 10. 6. 2021 v 16:05 odesílatel Janusz S. Bień  napsal:
>
>
> Hi!
>
> Please have a look at the enclosed example.
>
> I suspect there is something wrong with the graphic file although no
> tool reports any problem.
>
> The file was exported from Gimp, the source was a TIFF file created by
> little known and little used ddjvu program (I used it for the first time
> just now).
>
> I will appreciate your help.
>
> Best regards
>
> Janusz
>
>
>
> --
>  ,
> Janusz S. Bien
> emeryt (emeritus)
> https://sites.google.com/view/jsbien


overlap-crop.pdf
Description: Adobe PDF document


[XeTeX] strange case of overlapping graphics

2021-06-10 Thread Janusz S. Bień

Hi!

Please have a look at the enclosed example.

I suspect there is something wrong with the graphic file although no
tool reports any problem.

The file was exported from Gimp, the source was a TIFF file created by
little known and little used ddjvu program (I used it for the first time
just now).

I will appreciate your help.

Best regards

Janusz

<>


-- 
 ,   
Janusz S. Bien
emeryt (emeritus)
https://sites.google.com/view/jsbien