Suppose, I have multiple format of a image e.g. png, jpeg, jpg, svg etc. Which should I use for better looks?


latex has no control over this at all, it depends on the engine or driver you are using. For example tex+dvips can not include png, jpg or svg but can include bmp and eps; tex+dvipdfmx can include png and jpg (as well as pdf).; pdftex similarly can include png, jpg and pdf; as can luatex; xetex uses xdvipdfmx so can use the same graphics formats as tex+dvipdfmx.

Of the ones you mention png is good for general bitmaps, jpg for photographs and svg (which will usually be converted to pdf before inclusion) is good for scalable vector drawings, however those are features of the graphics formats so not really on topic here. Usually for scalable graphics people use eps (for latex+dvips) or pdf (for everything else)

  • Whilst not directly related to formats as David has advised. You should also consider the scale of the output and the intended end viewer. It is pointless having vectors that are too thick or thin at reader zoom levels. For images if the density is too high the output is unwieldy (often the case) however if resolution is too low the perceived quality will be poor when enlarged.
    – user170109
    Sep 22 '18 at 10:50

It depends on the kind of images that you want to insert. Is it line art or photos?

Raster images (photos or scans)

While jpg uses lossy compression (you can usually decide which level) png uses lossless compression. You will have a higher quality using png the drawback is that in LaTeX usually png require more time to process see this question. So the general rule, not only restricted to LaTeX, is to use jpg for photos and png for images with text and lines that you could not vectorize (as shown below). The conversion of photos in .pdf is not always the best approach I would rather use a .jpg directly.

Vector images

Returning to LaTeX if you are using vectorized graphics there are some good alternatives to svg that can give you better results and freedom to edit the figure even after you have inserted in your document. The first alternative is to export the file in pdf, if you are using pdflatex it's usually the easiest choice, however, be aware that sometimes if you did not export the pdf well you might have some images or pieces of images that you can display in the viewer but are not printed in the final printed copy, so check always the results of the printed copy. It happened to me many times and can be very dangerous.

You can create vector images directly in .tikz or export them in .pgf, the drawback of this approach is that in a thesis, for example, the compilation time of multiple .tikz or .pgf figure could become very high. The good thing is that you can edit directly the test and sometimes the data that you are plotting. Be aware that also in this case you might experience errors in the printing so always double-check.

A good compromise might be to create a .pdf image with .tex file for the text, you can do it in Inkscape as in this answer. In this way, you have the possibility to have control over the text in your figure without penalizing to much the compilation time.

  • jpg: for real pictures, e.g. photos
  • png: screenshot, simple drawings
  • pdf: vector graphics, documents

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.