I have a code to break up a picture into parts and I'd like to print them out together (with a small space between them), but retain the same sizes so the full image is still clearly visible.
def crop_image(img, quadrant): img = img_to_array(img) d = img.shape rows = int(d[0]*2/3) cols = int(d[1]*2/3) q = {"TL": img[:rows,:cols,:], "TR": img[:rows,cols:,:], "BL": img[rows:,:cols,:], "BR": img[rows:,cols:,:]} return array_to_img(q[quadrant]) img = load_img('./example1.jpeg', target_size=(224, 224)) cropped = crop_image(img, 'TR') fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2,2) ax1.imshow(crop_image(img, 'TL')) ax1.axis('off') ax2.imshow(crop_image(img, 'TR')) ax2.axis('off') ax3.imshow(crop_image(img, 'BL')) ax3.axis('off') ax4.imshow(crop_image(img, 'BR')) ax4.axis('off') fig.subplots_adjust(hspace=0.1) plt.tight_layout() 
