2

related question dimension-too-large-error-from-pdflatex-when-using-includegraphics

I have a normal looking small png file, which produces the same error as in the above question, but this is for png and not pdf and the image is small and verified

>file image3.png 
image3.png: PNG image data, 600 x 900, 8-bit/color RGBA, non-interlaced

>ls -l image3.png 
-rwxrwxrwx 1 me me 322135 Jul 11 15:11 image3.png

>convert image3.png -print "Size: %wx%h\n" /dev/null
Size: 600x900

When I compile it, I get

(/usr/local/texlive/2016/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
! Dimension too large.
<argument> \wd \@tempboxa 

l.6 ...udegraphics[width=0.95\linewidth]{image3.png}

? 

MWE

\documentclass[11pt]{scrbook}%
 \IfFileExists{luatex85.sty}{\usepackage{luatex85}}{}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=0.95\linewidth]{image3.png}
\end{document}

Compile

>lualatex foo.tex 
This is LuaTeX, Version 0.95.0 (TeX Live 2016) 
 restricted system commands enabled.
(./foo.tex
LaTeX2e <2016/03/31> patch level 2
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/koma-script/scrbook.cls
Document Class: scrbook 2016/06/14 v3.21 KOMA-Script document class (book)
(/usr/local/texlive/2016/texmf-dist/tex/latex/koma-script/scrkbase.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/koma-script/scrbase.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/koma-script/scrlfile.sty
Package scrlfile, 2016/06/14 v3.21 KOMA-Script package (loading files)
                  Copyright (C) Markus Kohm

))) (/usr/local/texlive/2016/texmf-dist/tex/latex/koma-script/tocbasic.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/koma-script/scrsize11pt.clo)
(/usr/local/texlive/2016/texmf-dist/tex/latex/koma-script/typearea.sty
Package typearea, 2016/06/14 v3.21 KOMA-Script package (type area)
                  Copyright (C) Frank Neukam, 1992-1994
                  Copyright (C) Markus Kohm, 1994-

)) (/usr/local/texlive/2016/texmf-dist/tex/generic/luatex85/luatex85.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2016/texmf-dist/tex/lualatex/luatex-def/luatex.def
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(./foo.aux)
(/usr/local/texlive/2016/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/grfext.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/etexcmds.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifluatex.sty))))
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/luatex-loader.sty
(/usr/local/texlive/2016/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/local/texlive/2016/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
! Dimension too large.
<argument> \wd \@tempboxa 

l.6 ...udegraphics[width=0.95\linewidth]{image3.png}

? 

Same error with pdflatex.

The image3.png is in this folder

Mathematica graphics

Question is: Why Am I getting this error on this image? The image is just an image of a book cover, which display just fine with any image viewer program.

TL 2016


Update

Thanks to comment, I used exiftool to check the image, here is the output

>exiftool image3.png 
ExifTool Version Number         : 9.46
File Name                       : image3.png
Directory                       : .
File Size                       : 315 kB
File Modification Date/Time     : 2016:07:11 15:11:18-05:00
File Access Date/Time           : 2016:07:11 15:28:49-05:00
File Inode Change Date/Time     : 2016:07:11 15:11:18-05:00
File Permissions                : rwxrwxrwx
File Type                       : PNG
MIME Type                       : image/png
Image Width                     : 600
Image Height                    : 900
Bit Depth                       : 8
Color Type                      : RGB with Alpha
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
SRGB Rendering                  : Perceptual
Gamma                           : 2.2
Pixels Per Unit X               : 78
Pixels Per Unit Y               : 78
Pixel Units                     : Meters
Image Size                      : 600x900

why does it say pixel units Meters in there?? This sounds little strange to me.

Here is a pic of the image

Mathematica graphics

  • Check if the image has a wrong DPI info. You should use some program like exiftool to check it. (Just a shot in the dark) – Rmano Jul 11 '16 at 21:07
1

I found the problem. Somehow the images has resolution 1.98 pixels per inch

Mathematica graphics

Opened it and saved it back using PAINT.NET as 300 pixels per inch

Mathematica graphics

And now the compile error went away.

So it looks like something was wrong in the image? I do not know how this happened.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.