I am pretty much new with PIL for python and I was wondering how to control picture positions with PIL. For example I have 4 pictures.
list_im = ['test1.png', 'test2.png', 'test3.png', 'test4.png' ]
imgs = [ PIL.Image.open(i) for i in list_im ]
min_shape = sorted( [(np.sum(i.size), i.size ) for i in imgs])[0][1]
imgs_comb = np.hstack( (np.asarray(i.resize(min_shape)) for i in imgs))
imgs_comb = PIL.Image.fromarray( imgs_comb)
imgs_comb.save( 'test.png')
This code returns 4 merged pictures in shape (1,4), what If I would like to have (2,2) or (1,3) or (3, 1)? Can't seem to understand the logic behind the code