Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active September 13, 2024 20:16
Show Gist options
  • Save aspose-com-kb/76bf3ac5b80bc74eaccf8de217b068a2 to your computer and use it in GitHub Desktop.
Save aspose-com-kb/76bf3ac5b80bc74eaccf8de217b068a2 to your computer and use it in GitHub Desktop.
Rotate Image in Python. For more details: https://kb.aspose.com/imaging/python/rotate-image-in-python/
import aspose.imaging
from aspose.imaging import Image, RotateFlipType
import os
path = "C://SampleFiles//"
license = aspose.imaging.License()
license.set_license(path + "License.lic")
# Rotate, flip and save to the output file.
with Image.load(os.path.join(path, "grayscaled.jpg")) as image:
image.rotate_flip(RotateFlipType.ROTATE_90_FLIP_NONE)
image.save(os.path.join(path, f"rotate90.png"))
print("Image Rotated Successfully")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment