2

Depending how an image is produced, its file extension is either .png or .PNG. For example, if I have a file myimage.PNG and I place that in my document with \includegraphics{myimage.png} I get the error:

Error: File 'myimage.png' not found

I would like to tell \includegraphics... not to care whether the extension is lower case or capitalised.

2
  • 7
    Just omit the extension :-)
    – campa
    Commented Oct 18, 2016 at 10:43
  • Great I didn't know that was possible, thank you!
    – airdas
    Commented Oct 18, 2016 at 12:41

1 Answer 1

2

This happens on file systems which distinguish between upper- and lower-case characters in file names, most notable under Linux.

One way to fix this is to rename all image files to only have lower-case extensions (try rename '/\.PNG/.png/' *.PNG under Linux).

Alternatively just leave the file extension and only write the file base name: \includegraphics{myimage}. This way a list of file extensions are then checked and the first image found is used. You can alter this list of default extensions using the macro \DeclareGraphicsExtensions {<comma separated list>}. By default it includes already both .png and .PNG (as well as .jpg and .pdf etc.). Note that with this way you might end up with the wrong extension if you have multiple formats of the same image, e.g. myimage.png and myimage.jpg.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .