[Tex/LaTex] ModernCV Banking photo title

moderncv

I added a photo in ModernCV Title using the command below. The results are in example 1. I would like to have it in a way that the both the photo and title are centered in the title as one bloc as in example 2.

Code

\makeatletter
\@ifpackageloaded{moderncvstylebanking}{%
\let\oldmakecvtitle\makecvtitle
\renewcommand*{\makecvtitle}{%
  \oldmakecvtitle%
  {\raggedleft\includegraphics[scale=0.8]{picture}\par}%
}%
}{%
}
\makeatother

Example 1

Example 2

Best Answer

You can patch \maketitle - used by the banking style in moderncv to create the title.

The default width of the title in banking is .8\textwidth, leaving .2\textwidth "to play with. The patch below inserts an image to the right of the title:

\patchcmd{\maketitle}% <cmd>
  {\\[2.5em]}% <search>
  {\hfill\includegraphics[width=.2\textwidth,height=50pt]{example-image}\\[2.5em]}% <replace>
  {}{}% <success><failure>

You may have to fiddle with the vertical positioning through \raisebox:

enter image description here