# Customizing the height of a figure

How do I to increase the height of a figure? and keeping its width like it's mention in the below code.

\begin{figure}[H]
\hfill{}\includegraphics[width=\linewidth]{images/cu_global_initial}\hfill{}
\caption{Diagramme de cas d'utilisation global initial}
\label{fg:diag_cu_glbl}
\end{figure}


• Additionally giving height and keepaspectration should do the trick, right? – Johannes_B Feb 14 '14 at 11:23
• If you want to center your image use \centering. The \hfill construction you show is a bit strange, the first \hfill will be discarded as it is at the start of the line, the second \hfill would make it flush left, except that the image is full width so there is no alignment possible. – David Carlisle Feb 14 '14 at 11:33
• Do you want to do "as if" the figure had a width of \linewidth and a given height, or do you want to zoom the figure up those two dimensions? – Bernard Feb 14 '14 at 12:10

Below is a code for both cases:

        \documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{graphicx}

\begin{document}
Voici une figure :

\begin{figure}[!h]
\centering\fbox{\raisebox{0pt}[6cm]{\includegraphics{airepara}}}%[width=\linewidth]
\caption{Diagramme de cas d'utilisation global initial
\label{fg-aire}}
\end{figure}

Comme on le voit sur la figure \ref{fg-aire}, blablabla…

S’il s’agit d’effectuer un zoom :

\begin{figure}[!h]
\centering\fbox{\includegraphics[width=\linewidth, height = 8cm, keepaspectratio]{airepara}}%
\caption{Diagramme de cas d'utilisation global initial
\label{fg-aire}}
\end{figure}

\end{document}


(replace "airepara" by any graphics file that TeX can fing on your system).