1

Consider this code

\documentclass{report}
\usepackage{graphicx}
\begin{document}
\begin{figure}[htp]
\includegraphics[width=0.4\textwidth]{imageA.png}
%\includegraphics[width=0.4\textwidth]{imageB.png}                                                                                                                                      
\end{figure}
\end{document}

Compilation works fine with pdflatex. With xelatex however imageA.png is displayed blank while imageB.png appears normally.

I don't see any warnings what might be wrong with imageA.png nor anything specific in the .log files. Nor do I see any warnings referred to in Why can't XeTeX handle this dank meme?

Any clues?

Viesturs
  • 7,895
  • use the --nopdf option to xetex, so it makes a xdv file then run xdvipdfmx on the xdv to get the pdf, that way you will see any warnings from the dvi driver, which are usually hidden – David Carlisle Jan 29 '19 at 11:23
  • I run xelatex figcheck.tex --nopdf but cannot find any xdv file – Viesturs Jan 29 '19 at 11:29
  • It should be xelatex --no-pdf figcheck.tex – Ulrike Fischer Jan 29 '19 at 11:30
  • I see figcheck.xdv -> figcheck.pdf [1] 50837 bytes written butthere are no warnings. – Viesturs Jan 29 '19 at 11:33
  • Run xdvipdfmx -vv figcheck.xdv – Ulrike Fischer Jan 29 '19 at 11:38
  • I don't see any difference from xdvipdfmx -vv figcheck.xdv for imageA and imageB – Viesturs Jan 29 '19 at 11:44
  • Perhaps something broken with imageA. As a last resort I would import it in Gimp and re-export it. – AlexG Jan 29 '19 at 12:29
  • Could it be of help to indicate that the troublesome png image has been downloaded from http://vveckaln.web.cern.ch/vveckaln/colour_flow/Rivet/merged_22August_corr_on/pull_angle/Rivet/DeltaRTotal/charge/allconst/ShowPlot.php?pic=pull_angle_allconst_Rivet_leading_jet_:_2nd_leading_jet_DeltaRTotal_4j2t.png – Viesturs Jan 29 '19 at 18:41
  • 1
    The dpi of that image is way out (3dpi) if it was loaded at that scale it would be from here to infinity (toy story joke actually = 155.67 inches !) the default is usually 72 or more likely 96 dpi = 4.86 inches which will fit on the page –  Jan 29 '19 at 19:09
  • @KJO, how to correct it? – Viesturs Jan 29 '19 at 19:10

1 Answers1

3

See if this download works for you in XeLaTeX

enter image description here

Odd values for dpi can be a problem with different formats such as bmp or png often downloaded by right click from the internet.

In windows 10 folders you can add columns for horizontal and vertical resolution I cant remember if that changed from earlier versions. enter image description here MS paint will also show the problem file properties as 3 dpi x 3dpi but an image with no dpi might on some systems appear as 96 (the default). If you right click download an image with no dpi it will likely also fail.

For a fuller description of a similar problem in XeTeX and an old workaround using MSpaint to save as/re-save as see https://tex.stackexchange.com/a/463610/170109

Depending on your needs to modify images during beamer compilation you may find this answer of interest https://tex.stackexchange.com/a/455862/170109

  • What did you change and how? – Viesturs Jan 29 '19 at 19:14
  • 1
    Using ifanview on windows simply set dpi to 96 many graphics packages will do similar and likely one of your repertoir of programs could given the right parameters. –  Jan 29 '19 at 19:17
  • Why is this an issue only for xelatex but not for pdflatex? – Viesturs Jan 29 '19 at 19:17
  • Unsure others may answer, but XeLaTeX may be more strict in using the ratio stated by the image, has been similar issues for pdfLaTeX users when not aware of the possibility –  Jan 29 '19 at 19:20
  • How do you check the dpi of an image? – Viesturs Jan 29 '19 at 19:25