Compare PDF and JPG Figures Inserted in LaTeX Document — The former format is preferred

Nov. 08, 2025 in Buffalo, United States • Updated Nov. 15, 2025

In LaTeX, we’d better insert figures in PDF format, rather than JPG. One reason is that if we insert a PDF figure, then those text in which can be selected and searched, but JPG figure, no. For example:

1
2
3
4
5
6
7
8
9
10
11
\documentclass{IEEEtran}
\usepackage{graphicx,subfig}

\begin{document}
\begin{figure}
	\centering
	\subfloat[]{\includegraphics[width=0.5\textwidth]{fig.jpg}}\hfill
	\subfloat[]{\includegraphics[width=0.5\textwidth]{fig.pdf}}\hfill
\end{figure}

\end{document}

image-20251112224505287

Above two figures are both generated by MATLAB script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
clc, clear, close all
rng('default')

figure('Color', 'w')
hold(gca, 'on')

num = 1000;
x = linspace(0, 3*pi, num);
y = cos(x) + rand(1, num);  
scatter(x, y, 'filled', 'MarkerFaceColor', 'r', 'MarkerEdgeColor', 'none', 'MarkerFaceAlpha', 1)
scatter(x, y+0.5, 'filled', 'MarkerFaceColor', 'g', 'MarkerEdgeColor', 'none', 'MarkerFaceAlpha', 1)
scatter(x, y+1, 'filled', 'MarkerFaceColor', 'b', 'MarkerEdgeColor', 'none', 'MarkerFaceAlpha', 1)

xlabel('x axis')
ylabel('y axis')
set(gca, 'FontSize', 20)

exportgraphics(gcf, 'fig.jpg', 'Resolution', 900)
exportgraphics(gcf, 'fig.pdf', 'Resolution', 900)

Another reason is that the generated PDF file size is smaller:

  • fig.jpg, 1,129 KB
  • fig.pdf, 48 KB.

and hence the compiled LaTeX PDF file is smaller:

  • The compiled LaTeX PDF file that only includes fig.jpg, 1,132 KB;
  • The compiled LaTeX PDF file that only includes fig.pdf, 50 KB;

Nice!