import os
# Open the image
image = Image.open(«image.jpg»)
# Get the dimensions of the image
width, height = image.size
# Create a new image with the desired dimensions
new_image = Image.new(«RGB», (width 2, height 2))
# Paste the original image into the new image
new_image.paste(image, (0, 0))
# Paste the original image again, but flipped horizontally, into the new image
new_image.paste(image.transpose(Image.FLIP_LEFT_RIGHT), (width, 0))
# Paste the original image again, but flipped vertically, into the new image
new_image.paste(image.transpose(Image.FLIP_TOP_BOTTOM), (0, height))
# Paste the original image again, but flipped both horizontally and vertically, into the new image
new_image.paste(image.transpose(Image.FLIP_LEFT_RIGHT).transpose(Image.FLIP_TOP_BOTTOM), (width, height))
# Save the new image
new_image.save(«new_image.jpg»)
# Display the new image
os.system(«open new_image.jpg»)