title: saving a grid of heterogenous images in Python
body: <p>How can I use something like below line to save images on a grid of 4x4 of heterogenous images? Imagine that images are identified by sample[i] and i takes 16 different values.</p>
  
  <pre><code>scipy.misc.imsave(str(img_index) + '.png', sample[1])
  </code></pre>
  
  <p>Similar to this answer but for 16 different images
  <a href="https://stackoverflow.com/a/42041135/2414957">https://stackoverflow.com/a/42041135/2414957</a></p>
  
  <p>I am not biased towards the used method as long as it does the deed. Also, I am interested in saving images rather than showing them using plt.show() as I am using a remote server and dealing with CelebA image dataset which is a giant dataset. I just want to randomly select 16 images from my batch and save the results of DCGAN and see if it makes any sense or if it converges.</p>
  
  <p>*Currently, I am saving images like below:</p>
  
  <pre><code>batch_no = random.randint(0, 63)
  
  
  scipy.misc.imsave('sample_gan_images/iter_%d_epoch_%d_sample_%d.png' %(itr, epoch, batch_no), sample[batch_no])
  </code></pre>
  
  <p>and here, I have 25 epochs and 2000 iterations and batch size is 64.</p>