I want to combine 5 png figures into one png or jpg file using the code in this answer. I want the final figure to look like:
and the pngs shouldn't be resized. I'm using the concatenate function:
import numpy as np
from PIL import Image
imgs = ['pics/myfig1.png',
'pics/myfig2.png',
'pics/myfig3.png',
'pics/myfig4.png',
'pics/myfig5.png']
concatenated = Image.fromarray(
np.concatenate(
np.array([
[imgs[0], imgs[1], imgs[2]],
[imgs[3], imgs[4]]])
)
)
concatenated.save( 'finalfig.jpg' )
But I get this error:
raise TypeError("Cannot handle this data type: %s, %s" % typekey) from e
TypeError: Cannot handle this data type: (1, 1), <U44