TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm rendering the following code with xelatex:

%% This gives ! LaTeX Error: Cannot determine size of graphic in lowres (no size specifed).
%% This works fine without specified size.

I've got the files 'lowres' and 'highres.png' in my current directory:

$ file lowres 
lowres: PNG image data, 348 x 350, 8-bit colormap, non-interlaced
$ file highres.png 
highres.png: PNG image data, 348 x 350, 8-bit colormap, non-interlaced

The obvious difference between these files is the lack of extension for 'lowres', so that's why I specify the type in the 'includegraphics'.

The problem is, it looks like it is mandatory to specify the size when the file hasn't got any extension (although we give the type as a parameter).

This behaviour doesn't make sense to me, is there a way to get around it?

share|improve this question
up vote 3 down vote accepted

If you don't specify an extension as part of the filename with \includegraphics a predefined set of extension is used to search for a suitable file. If you use only lowres then it looks for the files lowres.png, lowres.jpg and lowres.pdf (not necessary in this order) and uses the first one which is found. It does not look for a lowres file without any extension. The type option is rather deprecated, IIRC, and might not do what you expect from it.

The best thing would be to simply rename the file in question to have the correct file extension. You could also define an empty extension as part of the default extension list and remove the type option.

The following works for me. Apparently XeTeX is smart enough to figure out the real type without an extension, which actually isn't very difficult.

\DeclareGraphicsExtensions{.pdf,.png,.jpg,}% Note the trailing ',' which defines an empty extension
share|improve this answer
Brilliant, thanks! – jeje Jan 23 '12 at 12:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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