LaTeX forum ⇒ Graphics, Figures & TablesImages are empty Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Laurens
Posts: 7
Joined: Mon Feb 20, 2017 10:13 am

Images are empty

Postby Laurens » Mon Feb 20, 2017 10:17 am

Hello,

I recently got a new laptop and suddenly my images won't show up in existing latex files.

I've got this code:

  1. \usepackage{graphicx}
  2. ...
  3. \begin{figure}
  4. \centering
  5. \includegraphics[width=0.8\textwidth,natwidth=915,natheight=663]{test.png}
  6. \caption[ ]{test}
  7. \label{fig : test}
  8. \end{figure}


On my old laptop, this works correctly.

On the new laptop, I get an empty space. (note: no filename, just an empty image)

I added \fbox around it and the outline of the image is correct, it's simply the image that refuses to load...
I opened the image and there's nothing wrong with it.

I'm thinking I may have installed something the wrong way. I installed miktex, added all the graphicx packages I could find, yet no luck.
Any ideas?

Cheers.
Last edited by Stefan Kottwitz on Mon Feb 20, 2017 1:33 pm, edited 1 time in total.
Reason: code marked

Laurens
Posts: 7
Joined: Mon Feb 20, 2017 10:13 am

Postby Laurens » Mon Feb 20, 2017 10:25 am

Some additional info:

The above happens when I compile with PDFLaTeX.

When I compile with DVI -> PS followed by PS -> PDF I get a new error that says:

"Miktex GPL Ghostscript 9.19: Unrecoverable error, exit code 1 Miktex GPL Ghostscript 9.19: ERROR: A pdfmark destination page 4 points beyond the last page 3."

Now it only compiles 3 pages, the image is meant to be on the 4th page (out of a 16 page document)

If I move the image forward/backward the page error changes accordingly and the pdf shows less/more pages.

So it is a ghostscript error?

User avatar
Stefan Kottwitz
Site Admin
Posts: 9192
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Mon Feb 20, 2017 1:37 pm

Hi Laurens,

welcome to the forum!

PNG files are supported by pdfLaTeX, but not by LaTeX in DVI mode. So the second post via DVI and PS and ghostscript doesn't lead to a solution.

It could be a PNG property such as transparency that may cause the issue. I suggest one of these ways:

  • Convert to JPG (if possible with lossless compression, or 100% quality) and test it with test.jpg.
  • Convert to a bitmap format such as BMP (full colors) or JPG (without compression) and then convert back to PNG and test again.

Stefan
Site admin

Laurens
Posts: 7
Joined: Mon Feb 20, 2017 10:13 am

Postby Laurens » Mon Feb 20, 2017 1:56 pm

Thanks for the reply.

When I do DVI -> PS -> PDF on the other laptop, the document compiles fine and the pdf is the same, except the images are without color.
Now I get this error, so I suspect this is the source of the problem.
I already tried uninstalling Miktex and getting the exact same version as I'm running on the other laptop but that did not help.
I should note that this happens both in console and in my Latex environment.

I tried both your solutions and the problem remains.
I think the clue is in that ghostscript error message, I just don't know what it means exactly or how to fix it.

For now I moved everything to Overleaf, there the images load fine, though I will keep checking here for solutions as ideally I want to move back to my Latex environment.

Regards,
Laurens

User avatar
Stefan Kottwitz
Site Admin
Posts: 9192
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Mon Feb 20, 2017 2:05 pm

As you are not worrying about re-installing LaTeX: you could install TeX Live instead of MiKTeX. Overleaf works with TeX Live. I use it too, and I'm very satisfied with it. There's a new major version every year and it's continuously updated. It got a package manager tool too. I recommend though to install a complete TeX Live (same when it's MiKTeX), that saves headaches about missing packages later and makes life easier.

Stefan
Site admin

Laurens
Posts: 7
Joined: Mon Feb 20, 2017 10:13 am

Postby Laurens » Mon Feb 20, 2017 3:28 pm

Cheers for the tip.

I removed Miktex again and just finished the Tex Live install, unfortunately the same problem appears. Except the Ghostscript error when doing PS -> PDF now says GPL Ghostscript 9.20 instead of Miktex GPL Ghostscript 9.19. But that's pretty obvious.

So it is not connected to LaTeX/Ghostscript, and it is not connected to the figure or file extension.
I honestly have no idea what's causing this :P

edit: When I remove packages breakurl and hyperref, the second part of the GS error disappears and now it just says:
GPL Ghostscript 9.20: Unrecoverable error, exit code 1
It cuts off the PDF after 3 pages, which is where the image should be.
So you'd think the image is corrupted or something, the thing is it happens with every single image, even in a brand new latex file with a brand new image.

Laurens
Posts: 7
Joined: Mon Feb 20, 2017 10:13 am

Postby Laurens » Mon Feb 20, 2017 3:59 pm

If it helps, I created a minimal working example with the same issue:

  1. \documentclass[]{article}
  2.  
  3. \usepackage{graphicx}
  4.  
  5. %opening
  6. \title{}
  7. \author{}
  8.  
  9. \begin{document}
  10.  
  11. \maketitle
  12.  
  13. \section{}
  14.  
  15. \begin{figure*}
  16. \centering
  17. \includegraphics[width=0.8\textwidth,natwidth=915,natheight=663]{test.png}
  18. \caption[ ]{test}
  19. \label{fig : test}
  20. \end{figure*}
  21.  
  22. \end{document}


Here is the corresponding log:

This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/W32TeX) (preloaded format=pdflatex 2017.2.20) 20 FEB 2017 14:58
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**./test.tex
(./test.tex
LaTeX2e <2017/01/01> patch level 1
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(c:/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(c:/texlive/2016/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(c:/texlive/2016/texmf-dist/tex/latex/graphics/graphicx.sty
Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)

(c:/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
)
(c:/texlive/2016/texmf-dist/tex/latex/graphics/graphics.sty
Package: graphics 2016/10/09 v1.0u Standard LaTeX Graphics (DPC,SPQR)

(c:/texlive/2016/texmf-dist/tex/latex/graphics/trig.sty
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)
(c:/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 99.

(c:/texlive/2016/texmf-dist/tex/latex/graphics-def/pdftex.def
File: pdftex.def 2017/01/12 v0.06k Graphics/color for pdfTeX

(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty
Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO)
)
(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty
Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
)
\Gread@gobject=\count87
))
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
) (./test.aux)
\openout1 = `test.aux'.

LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.

(c:/texlive/2016/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count88
\scratchdimen=\dimen105
\scratchbox=\box26
\nofMPsegments=\count89
\nofMParguments=\count90
\everyMPshowfont=\toks15
\MPscratchCnt=\count91
\MPscratchDim=\dimen106
\MPnumerator=\count92
\makeMPintoPDFobject=\count93
\everyMPtoPDFconversion=\toks16
) (c:/texlive/2016/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
Package: pdftexcmds 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO
)

(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/ifluatex.sty
Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
)
(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/ifpdf.sty
Package: ifpdf 2016/05/14 v3.1 Provides the ifpdf switch
)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
)
(c:/texlive/2016/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
Package: epstopdf-base 2016/05/15 v2.6 Base part for package epstopdf

(c:/texlive/2016/texmf-dist/tex/latex/oberdiek/grfext.sty
Package: grfext 2016/05/16 v1.2 Manage graphics extensions (HO)

(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty
Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO)
))
(c:/texlive/2016/texmf-dist/tex/latex/oberdiek/kvoptions.sty
Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO)

(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO)

(c:/texlive/2016/texmf-dist/tex/generic/oberdiek/etexcmds.sty
Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
Package etexcmds Info: Could not find \expanded.
(etexcmds) That can mean that you are not using pdfTeX 1.50 or
(etexcmds) that some package has redefined \expanded.
(etexcmds) In the latter case, load this package earlier.
)))
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
38.
Package grfext Info: Graphics extension search list:
(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE
G,.JBIG2,.JB2,.eps]
(grfext) \AppendGraphicsExtensions on input line 456.

(c:/texlive/2016/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <12> on input line 11.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 11.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 11.
File: test.png Graphic file (type png)
Package pdftex.def Info: Interpreting graphics options as viewport.

<use test.png>
Package pdftex.def Info: test.png used on input line 17.
(pdftex.def) Requested size: 276.00105pt x 199.98299pt.
[1

{c:/texlive/2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] [2] (./test.aux
) )
Here is how much of TeX's memory you used:
1491 strings out of 493013
21118 string characters out of 6136993
77697 words of memory out of 5000000
5045 multiletter control sequences out of 15000+600000
7280 words of font info for 26 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
39i,5n,25p,232b,219s stack positions out of 5000i,500n,10000p,200000b,80000s
<c:/texlive/2016/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb><c:/te
xlive/2016/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb><c:/texlive/2016
/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb>
Output written on test.pdf (2 pages, 28470 bytes).
PDF statistics:
23 PDF objects out of 1000 (max. 8388607)
15 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)

Last edited by Stefan Kottwitz on Mon Feb 20, 2017 4:25 pm, edited 1 time in total.
Reason: code marked

User avatar
Stefan Kottwitz
Site Admin
Posts: 9192
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Mon Feb 20, 2017 4:26 pm

Can you also post the png file and the produced pdf output, as attachment here?

Stefan
Site admin

Laurens
Posts: 7
Joined: Mon Feb 20, 2017 10:13 am

Postby Laurens » Mon Feb 20, 2017 4:29 pm

Sure.

The .png shouldn't matter much, I've used 3 different images by now and the problem persists.
Attachments
test.png
test.png (24.17 KiB) Viewed 1818 times
test.pdf
(27.8 KiB) Downloaded 34 times

User avatar
Stefan Kottwitz
Site Admin
Posts: 9192
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Mon Feb 20, 2017 6:15 pm

Crazy thought: if all is called "test", the .tex file and the .pdf file too, perhaps don't call the image test.png but somethingelse.png so LaTeX would not try to include test.pdf in itself, even if you specified the file name extension png.

Stefan
Site admin


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 15 guests