I have some pictures saved at the same time in different image extensions, for example, pic1.png, pic1.pdf, pic1.jpg, pic2.pdf, pic2.png, pic3.jpg.

I would like to include preferably .pdf, if not, .png, and as last option .jpg, if no other format is available, when I include the picture in my LaTeX document using \includegraphics.

1 Answer 1


It seems that with this extensions, .pdf, .png, .jpg, (but not with .eps) I can determine the priority that the command includegraphics will use, if I declare the extensions in the desired order using \DeclareGraphicsExtensions. For example, in my case I would write \DeclareGraphicsExtensions{.pdf,.png,.jpg} to fix the priorities in this order .pdf, .png, and .jpg



  • 3
    this is documented in texdoc grfguide the same mechanism works for whatever file formats are supported by the driver you are using (although the details for eps with pdftex or luatex are a bit different as that requires a shell process to convert to pdf in the background) Dec 12, 2017 at 20:27
  • @DavidCarlisle Good to know. I really thought, it was something casual. I did not read the texdoc grfguide. Maybe I should read more guides instead of experimenting with latex. The question is: which of both methods is less time consuming? ;) Dec 18, 2017 at 1:18

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.