Skip to content

Instantly share code, notes, and snippets.

@CLozy
Last active July 12, 2022 12:12
Show Gist options
  • Save CLozy/c7f6d95aa67922037cee5145c4128a7a to your computer and use it in GitHub Desktop.
Save CLozy/c7f6d95aa67922037cee5145c4128a7a to your computer and use it in GitHub Desktop.
flipping image
image = Image.open('/content/gdrive/MyDrive/ComputerVisionEngineer/images/deadstar.jpg')
#horizontal flip
hor_flip = image.transpose(Image.FLIP_LEFT_RIGHT)
#vertical flip
ver_flip = image.transpose(Image.FLIP_TOP_BOTTOM)
#plot all three using matplotlib
f = pyplot.figure(figsize=(30,30))
f.add_subplot(131)
pyplot.imshow(image)
f.add_subplot(132)
pyplot.imshow(hor_flip)
f.add_subplot(133)
pyplot.imshow(ver_flip)
pyplot.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment