Documentation/Tables & Figures/Vector vs Raster Images in LaTeX — When to Use Which
Tables & Figures

Vector vs Raster Images in LaTeX — When to Use Which

Choosing the right image format has a huge impact on your paper's visual quality. Vector images (PDF, EPS) scale perfectly at any size, while raster images (PNG, JPG) can appear pixelated when enlarged. Understanding when to use each format is essential for producing publication-quality documents. Bibby AI supports all major image formats and renders them at full quality in the preview.

Understand the Key Differences

Vector images are defined by mathematical paths (lines, curves, shapes) and scale infinitely without quality loss. Raster images are grids of pixels and degrade when scaled up. Here's how to use each in LaTeX:

\usepackage{graphicx}

% VECTOR formats: Best for diagrams, plots, charts, logos, architecture figures
% Supported: .pdf, .eps (with pdflatex via epstopdf)
\begin{figure}[htbp]
\centering
\includegraphics[width=0.8\textwidth]{figures/architecture.pdf}
\caption{System architecture diagram (vector — crisp at any zoom level)}
\end{figure}

% RASTER formats: Best for photographs, screenshots, scanned images
% Supported: .png (lossless), .jpg (lossy, smaller files)
\begin{figure}[htbp]
\centering
\includegraphics[width=0.6\textwidth]{figures/microscope-sample.png}
\caption{Microscope image of the sample (raster — photographic content)}
\end{figure}

Export Plots as Vector PDFs from Python

Always export your matplotlib, seaborn, or plotly figures as PDF (vector) rather than PNG for use in LaTeX papers:

% In Python (matplotlib):
% fig.savefig('plot.pdf', bbox_inches='tight', dpi=300)
% fig.savefig('plot.eps', bbox_inches='tight')  % Alternative
%
% In Python (plotly):
% fig.write_image('plot.pdf')
%
% In R (ggplot2):
% ggsave('plot.pdf', width=6, height=4)

% Then in LaTeX:
\begin{figure}[htbp]
\centering
\includegraphics[width=0.7\textwidth]{plots/accuracy-comparison.pdf}
\caption{Accuracy comparison across models. Exported as PDF vector from matplotlib — text and lines remain sharp at any scale.}
\label{fig:accuracy}
\end{figure}

% For PHOTOGRAPHS, PNG is appropriate:
\begin{figure}[htbp]
\centering
\includegraphics[width=0.5\textwidth]{photos/experiment-setup.jpg}
\caption{Photograph of the experimental setup.}
\label{fig:setup}
\end{figure}

Convert Between Formats When Needed

Sometimes you receive images in the wrong format. Here are common conversion strategies and how to handle SVG files in LaTeX:

% SVG files are NOT directly supported by pdflatex.
% Convert SVG to PDF first using Inkscape (command line):
%   inkscape input.svg --export-filename=output.pdf
%   inkscape input.svg --export-filename=output.eps

% Or use the svg package to auto-convert (requires Inkscape installed):
\usepackage{svg}
\begin{figure}[htbp]
\centering
\includesvg[width=0.7\textwidth]{figures/diagram}  % No file extension!
\caption{Diagram imported directly from SVG}
\end{figure}

% To convert raster to higher quality for printing:
% Use at least 300 DPI for photographs
% Use at least 600 DPI for line drawings that must be raster
%
% Check image DPI in Python:
% from PIL import Image
% img = Image.open('figure.png')
% print(img.info.get('dpi', 'No DPI info'))

💡 Tips

  • Rule of thumb: if you created it with code (plots, diagrams), export as PDF. If it's a photograph, use PNG or JPG.
  • Use PNG for screenshots and images with sharp edges or text — JPG compression creates visible artifacts around text.
  • Never convert a raster image to PDF/EPS to make it 'vector' — it's still raster data inside a vector container.
  • Bibby AI displays both vector and raster images at full quality in the live preview, so you can verify sharpness before submitting.

Try This in Bibby AI

Write LaTeX faster with AI auto-complete and instant compilation.

Start Writing Free

Related Tutorials

Vector vs Raster Images in LaTeX — When to Use Which | Bibby AI