Rotate an image in LaTeX (angle, rotatebox)
\includegraphics[angle=90]{image.png} rotates the image by 90 degrees counterclockwise. Negative angles rotate clockwise.
Preamble
The snippets on this page need these lines before \begin{document}:
\usepackage{graphicx}Rotate with the angle key
The angle is given in degrees. LaTeX reserves the space of the rotated image, so the text around it moves aside.
\includegraphics[width=4cm,angle=90]{image.png}
\includegraphics[width=4cm,angle=-30]{image.png}Mind the order of width and angle
\includegraphics reads its keys from left to right. width=4cm,angle=90 scales the image to 4 cm and then turns it, so the result is 4 cm high. angle=90,width=4cm turns first and then scales the rotated image to a width of 4 cm.
\includegraphics[width=4cm,angle=90]{image.png}
\includegraphics[angle=90,width=4cm]{image.png}Rotate a figure with its caption
The sidewaysfigure environment from the rotating package turns image and caption together and puts them on a page of their own. Inside it, \textwidth is the height of the text block.
Complete document:
\documentclass{article}
\usepackage{graphicx}
\usepackage{rotating}
\begin{document}
\begin{sidewaysfigure}
\centering
\includegraphics[width=0.8\textwidth]{image.png}
\caption{A wide image on a page of its own}
\end{sidewaysfigure}
\end{document}Mirror an image
\reflectbox{...} mirrors its content horizontally. \scalebox{1}[-1]{...} mirrors it vertically: the first factor scales the width, the optional second one the height.
\reflectbox{\includegraphics[width=4cm]{image.png}}
\scalebox{1}[-1]{\includegraphics[width=4cm]{image.png}}Pitfalls
angleturns the image around its lower left corner.origin=cturns it around its center, which changes where the rotated image sits on the line.\rotatebox{90}{...}rotates any content, also text or a table.
Compiled with pdfLaTeX from TeX Live 2023.
Related pages
- Package
graphicx - Package
rotating - How-to Rotate a table in LaTeX
- How-to Rotate a single page to landscape in LaTeX
- How-to Resize an image in LaTeX