I have a very complex document with many pictures (jpg, png and pdf). In trying to improve compiling performance I tried to convert all pictures to jpg, then all pictures to png and then to pdf (with imagemagick and density 400). Then I timed the compiling times:

  • all pictures in pdf format: 41s
  • all pictures in jpg format: 41s
  • all pictures in png format: 55s

What are the reasons that png pictures are slower? Is it generally true that the same pictures in jpg and pdf format load with the same speed and that the same picture in png loads slower or can you report cases where the ranking is different?

Is there even a better format for performance than jpg/pdf?

Is there any general accepted "best practice" of which graphics format is the best for including non-vector-graphics into a pdflatex document with respect to performance and other aspects?

I used the texlive delivered with ubuntu 15.10.

  • PDF is vector graphics.
    – cfr
    Mar 25, 2016 at 23:05
  • 1
    Related: tex.stackexchange.com/questions/39929/…
    – egreg
    Mar 25, 2016 at 23:29
  • 1
    If you were thinking about optimising only compilation time, then you would save all images as very very low quality jpg files. "Best practice" is to choose the file type that is best for the particular type of image - i.e. shows that image at best quality for the lowest "cost" (in terms of size, compilation time and so on). Use jpg files for photographs and similar. png for line graphics with blocks of flat color and no gradients. Between those extremes there is a choice. You will end up with a mixture of file types. Compilation time seems the least relevant to optimise. Mar 26, 2016 at 0:17
  • Maybe see an old answer of mine: tex.stackexchange.com/questions/136087 Mar 26, 2016 at 1:14
  • Use draft except for the final version of when you specifically need to see the images? Note, too, that it depends on how large the images are. If you are creating huge imaes and then scaling them down, things are going to take longer for no discernible benefit (and maybe disbenefit).
    – cfr
    Oct 8, 2016 at 22:20

1 Answer 1


One thing to note is that if the JPG is converted to a PDF, it will still be a raster image. Perhaps if your figures were produced vectorized from the start it would speed things up. (Unless they already are, then it is a moot point.)

Here is one link that may address the PNG issue. Apparently pdfTeX uncompresses and recompresses the images, but there are some conditions under which this process may be short-circuited, so to speak, such that it just does a direct copy.

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.