I have a file called xxxx_0.1.png, and want to import it as an image in my document. I am using graphicx with the following command:


and LaTex gives me the error:

Unknown graphics extension: .1.png

Basically, it is treating everything after the first dot as the file type, rather than only the stuff after the last dot.

Other than the obvious solution (renaming the files so it only has one dot), does anyone know if there a way to get LaTex to play ball?

  • 4
    putting the name inside {} maybe? Apr 24, 2013 at 15:41
  • I know it won't solve the problem because it would then see .1 as the extension, but you don't actually need the last .png.
    – Betohaku
    Apr 24, 2013 at 15:43
  • LaTeX can manipulate strings using regular expressions. Seems rather like overkill in this case. Apr 24, 2013 at 15:43
  • Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}) or hit Ctrl+K. Apr 24, 2013 at 15:54

3 Answers 3


The LaTeX graphics/graphicx package uses the first dot to find the extension. Package grffile changes the algorithm to check for known extensions (option multidot, enabled by default):

  • 3
    And many thanks to you for that wonderfull grffile package, which makes it much more comfortable to include files.
    – Keks Dose
    Apr 24, 2013 at 16:02
  • That's like the worst possible way to find the extension... Why did no one fix this? Nov 15, 2017 at 14:05
  • 1
    According to the second answer of David Carlisle in LaTeX problem report graphics/2614 "filenames not handled correctly in graphics", the reason is (was) speed. However, the answer was given 1997. I do not know the official opinion of the LaTeX maintainers two decades later. Nov 15, 2017 at 18:53
  • 2
    @HeikoOberdiek the official position is that I plan to change the default parsing (actually I'd planned to have already done it by now, but real life got in the way, most likely for the next release....) Nov 15, 2017 at 19:06

Of course the obvious answer is just to rename the file so it doesn't have any dots in its name, but you can also try using {} braces for the name and get a good result. e.g.:


Edit: moved the closing brace before the extension, as mentioned in the comments.

  • 3
    Shouldn't the inner brace close before the .png - i.e. {images/{xxxx_0.1}.png} ?
    – sdaau
    Aug 1, 2013 at 22:16
  • I am having the same issue and this thread helped! And btw, @sdaau is correct with his comment. Oct 15, 2014 at 14:40

You can disable the filename parser by specifying the extension and file type as attributes. For pdftex that would be

\includegraphics[width=0.5\textwidth ext=.png type=png]{images/xxxx_0.1}

Your Answer

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