并排显示2个图片
import os
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
image1 = Image.open('a.png')
image2 = Image.open('a2.png')
# Create a figure with two subplots (1 row, 2 columns)
fig, axes = plt.subplots(1, 2, figsize=(10, 5))
# Display the first image on the first subplot
axes[0].imshow(image1)
axes[0].axis('off') # Hide the axis
# Display the second image on the second subplot
axes[1].imshow(image2)
axes[1].axis('off') # Hide the axis
# Show the plot
plt.tight_layout()
plt.show()