2

How to rotate a framed image? the following code rotate the image without the frame?

Thanks

\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{graphicx}

\begin{document}
\begin{titlepage}

\begin{tikzpicture}[overlay, remember picture]
\node[anchor=north west, %anchor is upper left corner of the graphic
      xshift=8.5cm, %shifting around
      yshift=-16cm] 
     at (current page.north west) %left upper corner of the page
     {\includegraphics[
         trim   = {1 1 1 1}, clip, 
         width  = 10.5cm, 
         rotate = 4, 
         angle  = 0.35, 
         frame]{Image.png}}; 

\end{tikzpicture}
\end{titlepage}
\end{document}
0

2 Answers 2

3

The keys passed are executed in order*, so a simple shuffling of frame before trim should be sufficient.

A margin key was passed purely for illustrative reasons. You may omit it in the final version.

\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{graphicx}

\begin{document}
    \begin{titlepage}
        \begin{tikzpicture}[overlay, remember picture]
        \node[anchor=north west, %anchor is upper left corner of the graphic
        xshift=8.5cm, %shifting around
        yshift=-16cm] 
        at (current page.north west) %left upper corner of the page
        {\includegraphics[
            margin = 1pt, % <------- Just to show the frame
            frame, % <---------- Execute this first
            trim   = {1 1 1 1}, clip, 
            width  = 10.5cm, 
            rotate = 4, 
            angle  = 0.35
            ]{example-image}}; 
        \end{tikzpicture}
    \end{titlepage}
\end{document}

gives

frame rotated

*Not all keys are executed in order, trim, for example, always acts on the original content. See the documentation for adjustbox for more details.

6

Maybe a simple rotatebox could be used instead of the heavy tikz weapons?

\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{graphicx}

\begin{document}
\begin{titlepage}

{
    \setlength{\fboxsep}{0pt}
    \rotatebox{4}{%
        \fbox{%
            \includegraphics[%
           trim   = {1 1 1 1}, clip, 
           width  = 10.5cm, 
            ]{example-image}%
        }%
    }%
}

\end{titlepage}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .