Method
img2=img.transpose(pilImage.FLIP_LEFT_RIGHT) #Horizontal symmetry
#img2=img.transpose(pilImage.FLIP_TOP_BOTTOM) #Vertical symmetry
Sample Code
#Symmetry Transformation
from openpyxl import Workbook
from openpyxl.drawing.image import Image as xlImage
from PIL import Image as pilImage
#Create a workbook
wb=Workbook()
#Get the active worksheet
ws=wb.active
# Open the original image file
img=pilImage.open('pic.jpg')
#Apply a symmetry transformation
img2=img.transpose(pilImage.FLIP_LEFT_RIGHT) #Horizontal symmetry
#img2=img.transpose(pilImage.FLIP_TOP_BOTTOM) #Vertical symmetry
# Save the transformed image as a temporary file
path='image4.jpg'
img2.save(path)
# Add the image to the worksheet
img=xlImage(path)
ws.add_image(img, 'A1')
# Save the workbook
wb.save('image06.xlsx')
# Delete the temporary file
import os
os.remove(path)

