[Tex/LaTex] Arranging images as grid

graphics

I have about 400 images namely 1.jpg,2.jpg etc. I want to arrange it in grid. I don't want any captions or margins. Is there any easy way to achieve this

I don't need any space between images. A 3×4 grid will be fine

Best Answer

your question is not very clear and seems to be duplicate to many similar question here. You need to put some small effort in search this site ... anyway, you can start with the following approach:

\documentclass{article}
\usepackage{graphicx}

\begin{document}
\begin{figure}[htbp]
  \centering
\setkeys{Gin}{width=0.3\linewidth}
  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}

  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}

  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}

  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}\,%
  \includegraphics{example-image-duck}
\end{figure}
\end{document}

enter image description here

addendum: in the case, that name of images' files are 1, 2, ... 396 and you like to present them in 33 groups of 12 images (33 x 12 = 396) per figure organised in array 3 x 4 images you can make above example shorter with use two loops:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{pgffor}  % <---

\begin{document}
\begin{figure}[htbp]
\def\kk{2} % number of images group 1, 2, ... 33
\foreach \i [count=\k from 5+4*(\kk-1)] in {1,...,4}% <--- for rows
{
\foreach \j in {1,2,3}{\pgfmathparse{int(3*(\k-1)+\j)}% <--- for columns
                       \includegraphics[width=0.32\linewidth]{\pgfmathresult}%
                        \ifnum\j<3\,\else\fi%
                       }
}
\end{figure}
\end{document}