I have about a hundred images named 001.png to 123.png. I want to create a document which includes each image in center of a page. i.e. a 123 page document with each image on a single page.

I know that doing this is possible using macros but I have no clue how to do that. Any help is appreciated.

  • Welcome to TeX.SX! Will the document contain other things or just the images?
    – egreg
    Sep 27, 2012 at 10:34
  • Here is a very similar question with a lot of approaches: tex.stackexchange.com/q/53458/10570
    – Holle
    Sep 27, 2012 at 10:47
  • @Holle They are aimed at printing all files in some directories. Here the situation is simpler.
    – egreg
    Sep 27, 2012 at 10:50
  • @egreg Thanks :) No, I don't need anything else other than the images.
    – Asghar
    Sep 27, 2012 at 11:09

1 Answer 1


If you need only the images in the center of the page, just loop:



    \\[12pt]\texttt{\current.png} % comment if you don't want the file name here
  \ifnum\value{#1}<100 0\fi\ifnum\value{#1}<10 0\fi\arabic{#1}%

I used the demo option for graphicx just to avoid the need to populate my folder with mock images.


You must log in to answer this question.

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