# How to adjustbox trim logo in preamble?

I have an official logo, which has white background and much margins around. So the logo does not look good without trimming at the top-left corner of Berkley theme in Beamer. Code

\documentclass{beamer}

\usepackage{graphics}

\usetheme{Berkeley}
\logo{
% llx lly urx ury
\adjustbox{trim=0.2\width{} 0.1\height{} 0.2\width{} 0.1\height{}, clip, height=1.2\textheight{}}{
\includegraphics[height=1cm]{logo.png}
}
}

\begin{document}
\begin{frame}
\begin{titlepage}
Leo Leopold Hertz.
\end{titlepage}
\end{frame}
\end{document}


Fig. 1 Logo example, Fig. 2 Output of the code

## Testing samcarter's answer with random image

I try to auto-adjust width and height of the image but I cannot get it to work

% http://tex.stackexchange.com/a/215317/13173


## Final proposal which works

\includegraphics[trim=5.3cm 0.2cm 5cm 1.2cm,clip, height=\headheight, width=\headheight]{logo.p‌​ng}


OS: Debian 8.5
TeXLive: 2016

• So what exactly is the question? – samcarter_is_at_topanswers.xyz Dec 30 '16 at 13:47
• If you want trim/clip included graphics (as your logo), use the trim and clip options of \includegraphics. The adjustbox package provides options to clip or trim LaTeX mateial. – Paul Gaborit Dec 30 '16 at 14:44
• @LéoLéopoldHertz준영 Here are examples. – Paul Gaborit Dec 30 '16 at 14:48
• @LéoLéopoldHertz준영 Did you try to use trim and clip options of \includegraphics? If so, what is the problem? – Paul Gaborit Dec 30 '16 at 17:50

I still have no idea, what your intended output should look like, so this is just a guess:

\documentclass{beamer}

\usetheme{Berkeley}

\logo{%
\includegraphics[trim=5.3cm 0.2cm 5cm 1.2cm, clip, height=\headheight]{logo.png}%
}

\begin{document}
\begin{frame}
\begin{titlepage}
Leo Leopold Hertz.
\end{titlepage}
\end{frame}
\end{document}