# Placing an image by the side of the title in LaTeX

I'm trying to place an image besides the maketitle command without messing it up, but after a lot of trial and error, I have something that just partially resembles what I'm going for and the source is a mess.

I'm trying to make it look like this (Normal maketitle, added image in acrobat after)

But right now, this is as close as I can get it (also, notice how there's this big space between the top of the image and the content):

this is the code used for the latter image. If someone know of a better method/package or some other way to do this better, please let me know.

\documentclass[a4paper]{article}
\usepackage[utf8x]{inputenc}
\usepackage{graphicx}
\usepackage{float}
\usepackage{geometry}
\usepackage[T1]{fontenc}
\usepackage[normalem]{ulem}
\usepackage{wrapfig}
\usepackage{titling}

\newcommand{\middlewavefill}[1]{\begin{center}{\raisebox{0.5em}{\uwave{\hspace{#1}}}}\end{center}}

\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
margin=15mm,
}

\title{My life in Japan}
\date{Mal}
\author{Name}

\pretitle{
\hspace{5cm}
\begin{wrapfigure}{l}{1cm}
\includegraphics[width=6cm]{japanFlag}
\end{wrapfigure}
\centering \huge
}
\posttitle{
\vspace{1cm}
}

\begin{document}

\begin{figure}[!t]

\maketitle
\end{figure}
\middlewavefill{18cm}

\end{document}


You can put \maketitle inside a minipage and use \raisebox to align the image. Also, you don't HAVE to use \maketitle. it is supposed to be a convenience, not an obstacle.

\documentclass[a4paper]{article}
%\usepackage[utf8x]{inputenc}% not with my editor
\usepackage{graphicx}
\usepackage{float}
\usepackage{geometry}
%\usepackage[T1]{fontenc}
\usepackage[normalem]{ulem}
\usepackage{wrapfig}
\usepackage{titling}

\newcommand{\middlewavefill}[1]{\begin{center}{\raisebox{0.5em}{\uwave{\hspace{#1}}}}\end{center}}

\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm,
margin=15mm,
}

\title{My life in Japan}
\date{Mal}
\author{Name}

\begin{document}
\noindent\raisebox{-\height}{\includegraphics[width=6cm]{example-image}}\hfill
\begin{minipage}[t]{\dimexpr \textwidth-6cm-\columnsep}
\maketitle
\end{minipage}

\middlewavefill{18cm}

\end{document}