Added information about scaling and rotating images

This commit is contained in:
Kenneth John Odle 2023-10-31 11:23:52 -04:00
parent 57642e91be
commit 32f3c96cda
3 changed files with 57 additions and 0 deletions

BIN
images/birb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

BIN
images/seahorse.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -1379,6 +1379,63 @@ You can also specify absolute paths to your files. For example, on a Windows sys
\graphicspath{ {/home/user/latex/images/} }
\end{Verbatim}
\section{Adding and Scaling an Image}
To include an image, use the \texttt{includgraphics} command:
\begin{Verbatim}[]
\includegraphics{birb}
\end{Verbatim}
\noindent{}which includes our ``birb'' picture:
\includegraphics{birb}
A couple of things to note: First, because of our \texttt{graphicspath}, this file could be located either in \texttt{images} or \texttt{standalone/build}. Second, we did not need to specify the file extension.
We can also scale the image by using a \texttt{scale} option, where 1 is equivalent to 100%:
\begin{Verbatim}[]
\includegraphics[scale=0.5]{birb}
\includegraphics[scale=0.9]{birb}
\includegraphics[scale=1.5]{birb}
\end{Verbatim}
\includegraphics[scale=0.5]{birb}
\includegraphics[scale=0.9]{birb}
\includegraphics[scale=1.5]{birb}
While it may be tempting to start with a huge image and simply scale it down, the entire image will be included in the final pdf document and can greatly increase its size. If you intend to distribute your document electronically, it helps to scale your image as close as possible to the size you actually need before including it in your file.
Note that images act like words—they neither float, and follow each other on the same line. This means that we could use something like this \Verb+\includegraphics[sca+ \Verb+le=1]{seahorse}+ \includegraphics[scale=1]{seahorse} to include inline graphics. However, this can affect the line spacing in our paragraph, as our ``seahorse'' image shows. We can adjust this a little bit by scaling the image appropriately, as in this example: \includegraphics[scale=0.4]{seahorse}, which I've inserted using \Verb+\includegraphics[scale=0.4]{seahorse}+.
You can also scale the x and y dimensions separately:
\begin{Verbatim}[]
\includegraphics[width=0.5\textwidth, height=1cm]{birb}
\end{Verbatim}
\includegraphics[width=0.5\textwidth, height=1cm]{birb}
\section{Rotating Images}
We can also use an \texttt{angle} option to rotate our images:
\begin{Verbatim}[]
\includegraphics[angle=0]{seahorse}
\includegraphics[angle=90]{seahorse}
\includegraphics[angle=180]{seahorse}
\includegraphics[angle=270]{seahorse}
\includegraphics[angle=360]{seahorse}
\end{Verbatim}
\includegraphics[angle=0]{seahorse}
\includegraphics[angle=90]{seahorse}
\includegraphics[angle=180]{seahorse}
\includegraphics[angle=270]{seahorse}
\includegraphics[angle=360]{seahorse}
\chapter{Referencing}\label{ch:referencing}