37 lines
1.6 KiB
TeX
37 lines
1.6 KiB
TeX
\chapter{Images}
|
|
|
|
\section{To Convert a PDF to an Image}
|
|
|
|
\lettrine[]{U}{se} the \texttt{pdftoppm} command (from the \label{poppler-utils} \texttt{poppler-utils}\index{poppler-utils} package) to convert part or all of a pdf to an image. For example, to convert a pdf to a png:
|
|
|
|
\begin{Verbatim}[]
|
|
pdftoppm input.pdf output -png
|
|
\end{Verbatim}
|
|
|
|
This will convert each page in the pdf to a png using the format ``output-01.png'' where ``01'' is the page number. To convert a single page of a multipage pdf, use the \texttt{-f} flag to specify which page to use. For example, this will convert page 5 to a png:
|
|
|
|
\begin{Verbatim}[]
|
|
pdftoppm input.pdf output -png -f 5 -singlefile
|
|
\end{Verbatim}
|
|
|
|
To convert a range of pages, use the \texttt{-f} flag to specify the first page to convert and use the \texttt{-l} flag to specify the last page of the range:
|
|
|
|
\begin{Verbatim}[]
|
|
pdftoppm input.pdf output -png -f 5 \l 10 -singlefile
|
|
\end{Verbatim}
|
|
|
|
The default resolution is 150 dpi. To change this, use the \texttt{-rx} flag to specify the resolution along the x-axis, and the \texttt{-ry} flag to specify the resolution along the y-axis;
|
|
|
|
\begin{Verbatim}[]
|
|
pdftoppm input.pdf output -png -rx 300 -ry 300
|
|
\end{Verbatim}
|
|
|
|
Doubling the resolution along both axes will increase the file size by an approximate factor of four, and will also increase the amount of detail in the image.
|
|
|
|
\section{To Extract Images from a PDF File}
|
|
|
|
\lettrine[findent=0mm]{T}{o} extract images from a pdf file, use the \texttt{pdfimages} command (also from the same package\index{poppler-utils} mention in \S \ref{poppler-utils} ).
|
|
|
|
\section{This is just a test}
|
|
|
|
And this is just some text. |