[Tex/LaTex] Background-image on titlepage at upper right corner

eso-picgraphics

I am trying to add a background image at the upper right corner of my titlepage with 1cm margins to the top and the right.

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\title{Test}
\author{Test}
\date{\today}

\usepackage{eso-pic}
\usepackage[demo]{graphicx}

\providecommand*\LenToUnit[1]{#1\@gobble}

\newcommand\AtPageUpperRight[1]{\AtPageUpperLeft{
\put(\LenToUnit{0.5\paperwidth},\LenToUnit{-1cm}){#1}}
}

\begin{document}

\AddToShipoutPictureBG*{
 \AtPageUpperRight{\raisebox{-\height}{\includegraphics{logo.pdf}}}
}

\maketitle

\end{document}

Is it possible to right align the image?

Best Answer

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\title{Test}
\author{Test}
\date{\today}
\usepackage{eso-pic}
\usepackage[demo]{graphicx}
\newcommand\AtPageUpperRight[1]{\AtPageUpperLeft{%
   \makebox[\paperwidth][r]{#1}}}
\begin{document}

\AddToShipoutPictureBG*{%
  \AtPageUpperRight{\raisebox{-\height}{\frame{\includegraphics[width=8cm]{Uni-Logo}}}}}
\maketitle

\end{document}

enter image description here