begin figure code example
Example 1: latex image caption
\begin{figure}
\includegraphics[width=\textwidth]{Picture}
\caption{Picture caption}
\end{figure}
Example 2: how to add image overleaf
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\title{A project with images}
\author{Overleaf}
\date{}
\begin{document}
\maketitle
\section{Introduction}
\begin{figure}[htp]
\centering
\includegraphics[width=4cm]{InsertingImagesEx5}
\caption{An image of a galaxy}
\label{fig:galaxy}
\end{figure}
\end{document}