title: fpdf spacing between pictures in python?
body: <p>I have found good code for making my all <code>.img</code> in one big pdf but I have a little problem.
  I don't know how rules for the margin between pictures work.
  I have a variable number of pictures in my directories, 66 pictures, in others 32, 72, and I would like 4 pictures per row and 4 per column, and after that, create another page in my pdf, is it possible?</p>
  <p>my function</p>
  <pre><code>class MyFPDF(FPDF):
       pass
  def photos_pdf():
      pdf = MyFPDF(&quot;L&quot;, format='A4', unit='mm')
      photos = glob.glob(filePath1 + &quot;/*&quot;)
      x = 5 # marge gauche
      y = 5 # marge haute
      counter = 0
      nbre = 3 # NOMBRE DE VIGNETTES PAR LIGNES
      nbre_par_page = 9
      counter2 = 0
      pdf.add_page()
      for photo in photos:
          if counter2 != nbre_par_page:    
              if counter != (nbre):
                  pdf.image(photo, x=x, y=y, w=63, h=88)
                  x += 79
                  counter += 1
                  counter2 += 1
              else:
                  counter = 0
                  x = 20
                  y += 72
          else:
              pdf.add_page()
              counter = 0
              counter2 = 0
              x = 20
              y = 10
      pdf.output(filePath1 + &quot;/A4_cards.pdf&quot;, 'F')
  photos_pdf()
  </code></pre>