Beamer: Full width image, aligned to top with a frame title

I helped myself out by adding a \vspace{-9.5pt}. The value seems not to change with standard themes. Nor does it matter whether a subtitle is present in the header. Still, I find it a non-general, somewhat sub-optimal solution. Who does better?

\documentclass[t]{beamer}
% Frames are 128x96mm and top-aligned by default.

% Calculate with \sidebarwidth etc.
\usepackage{calc}
\newlength{\sidebarwidth}

% Theme
\setlength{\sidebarwidth}{28mm}
\usetheme[height=16mm, right, width=\sidebarwidth]{Goettingen}
% Hence, a full frame image is 100x80mm
\usecolortheme{crane}

% Include full-width graphics
\usepackage{graphicx}
\newcommand{\includefullwidthgx}[2][]{%
\vspace{-9.5pt}
\noindent\makebox[\columnwidth]{\includegraphics[width=128mm-\sidebarwidth, #1]{#2}}%
}%

\begin{document}
\begin{frame}
\frametitle{Sub-optimal solution.}
\framesubtitle{Anyone does better?}
\includefullwidthgx{lion.jpg}
\end{frame}

\end{document}

enter image description here


The vertical space you see is composed of two parts, both of which are in some way specified in the beamerbaseframe.sty:

  1. If the frametitle is non-empty, beamer appends a \vskip0.25em to the \beamer@frametitlebox (line 122). This is hard-coded but can be avoided by not specifying a frametitle.

  2. In line 142 or 144, beamer issues a \vskip\beamer@frametopskip(autobreak). This skip is set depending on the vertical frame alignment (t/c/b); for t (top) it is 0.2cm plus…. It is set in the \define@key{beamerframe}{t}[true] (line 258) and can be changed by modifying or overwriting this \define@key.

These two components add up to the vertical space in your example. Beamer does not offer a straightforward way of getting rid of it, so probably it thinks it is a good thing.