4

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

11

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
3

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. The conversion of photos in .pdf is not always the best approach I would rather use a .jpg.

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.

I would try to create images directly in .tikz or export them in .pgf. An alternative might be to create a .pdf image with .tex file for the text.

1
  • 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.