63

LaTeX documents print beautifully, but images often looks "ugly", "pixelated" or "low-res" compared to the text. By images I don't mean photos, which I rarely use, but rather diagrams, charts and drawings made in other programs such as Visio, Excel and Photoshop. I would love for these to look just as good as the rest of the report when printed.

1

4 Answers 4

52

Vector Imagery


If you can, save diagrams as a vector-based format such as PDF or EPS- these formats can be readily included in LaTeX documents and scale without appearing pixelized. Note that PDF should be used for input to pdflatex and EPS should be used with plain latex.

Inkscape is an excellent, free, cross-platform program for creating and editing vector graphics- similar to Adobe Illustrator. There is even a project that is producing a plug-in for Inkscape that allows Inkscape graphics to be exported to TikZ.

TikZ is a TeX-based language for creating vector graphics- it is incredibly expressive and lets you create graphics right inside your TeX document. However, using TikZ requires writing out the commands required to create an image- it is not a GUI-based drawing program.

If you are using latex instead of pdflatex, then the PSTricks package is also available- but your document must be rendered into PostScript somewhere along the for the images to appear. However, passing through PostScript has advantages- PostScript is a complete programming language for creating graphics which PSTricks is able to leverage in order to produce some effects that are difficult/impossible to replicate using TikZ.

Raster Imagery


If all you have is a raster image, PNG, JPEG, GIF, TIFF, ect, then you must pay close attention to the resolution that the image file has been saved at. The resolution will determine how much scaling can occur before the image starts to appear pixelated.

Many programs default to saving images at 72 dpi (dots per inch) as that is a lightweight resolution that is commonly used for images displayed on the web. However, for printed output you need a much higher resolution for the results to look good. A common rule of thumb is that the final scaled image should have a resolution of at least 300 dpi if it is to appear on a printed page without noticeable pixelation.

3
  • 2
    If you've got a program that doesn't allow you to directly export to PDF, you still have an option. First print to PDF, which should nearly always be possible, even if you have to use PDFCreator under Windows ( sourceforge.net/projects/pdfcreator ). The printed PDF will often contain the vectorized image. Once you have the PDF, you can open it with Adobe Reader and select out just the desired area using the "Tools/Select & Zoom/Snapshot Tool". Once the right area is selected, it can be printed to PDF using File/Print with (again, under Windows) PDFCreator. Jul 27, 2010 at 21:27
  • 1
    For screen captures, scale 300% and set the DPI to 288. Dec 6, 2010 at 17:33
  • For photos, I usually put them in and make sure I apply no scaling (e.g. no \includegraphics[width=0.95\linewidth] or whatever). That way they'll appear far too small or too big if they're not of the correct resolution.
    – Sam Wilson
    Sep 11, 2018 at 7:30
29

I have switched to PGF/TikZ for all vector drawing. The level of control and the beauty of the results provided by this package is worth learning the syntax.

5
  • 2
    +1 absolutely agreed, I use TikZ almost exclusively for all graphics I include in LaTeX documents (and for other environments too, in many cases)
    – David Z
    Jul 26, 2010 at 21:36
  • 2
    I really wish there was a gui editor for tikz though: the learning curve is horrendous
    – Suresh
    Jul 26, 2010 at 23:35
  • 1
    @Suresh I agree that TikZ has a learning curve- but the tutorials provided in the documentation are amazing- even better than what I have seen in many commercial products. Of course, my learning style works best by working through examples so good tutorials may not be the best solution for everyone.
    – Sharpie
    Jul 27, 2010 at 0:04
  • I'm just bitter because as usual, I left my talk-making to the last minute, and didn't have time to learn enough TikZ to do the slides as I wanted :). But long-term it's a great solution for inline graphics - the lack of WYSIWYG is annoying though
    – Suresh
    Jul 27, 2010 at 0:11
  • 2
    Inkscape can export to tikz format via a plugin giving one the best of both worlds. Jul 27, 2010 at 7:10
18

If you're working with diagrams, I would recommend you to make them using vector graphics instead of raster graphics. This will allow you to upscale them infinitely. Inkscape (free) and Illustrator (paid) can make vector graphics. For graphs, I like to use graphviz (free).

3
  • 2
    Just to expand a bit, in general you want .ps, .eps, or .pdf. Stay away from .png, .jpg, .gif. Its possible to make raster version of any of these, but ant half-way decent drawing program should do the right thing with the first three. I've had good luck with pdfs and pdflatex.
    – KeithB
    Jul 26, 2010 at 21:27
  • Just to be precise; pdfs for pdflatex, eps/ps for latex.
    – user7
    Jul 26, 2010 at 22:02
  • I agree that vector is the way to go whenever possible, but if for any reason raster is required then it will still look good in print if you are able to save it at a resolution of 300 dpi or higher before including the .png, .jpg, or .gif graphic. Jul 26, 2010 at 23:41
11

One package that I'll do a shout out for is Ipe. You should think of Ipe as the next generation of xfig: great for line drawings, and by far the best killer feature: WYSIWYG latex. Ipe 7 has many of the modern vector graphics features (gradients, shading, transparency) etc that inkscape has, and is perfect for quick and dirty drawings.

it also has an extensible API, so if you need to demonstrate your algorithm, you can actually write an Ipe plugin in C++ that does the computation for you.

1
  • ipe really rocks! Just to add, all Lua lovers can go straight under the hood and create their own wonders.
    – percusse
    Sep 9, 2011 at 2:38

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.