# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 2
#     language: python
#     name: python2
# ---

# ### PIL from Pillow
# PIL stands for Python Imaging Library

# +
## Import Module
from PIL import Image

## Execption Hanlding of file import
try:
    img = Image.open("data/barr.png")
except IOError:
    pass
# -

# #### Retrieve the Image Size

width, height = img.size
print(width, height)

# #### Rotating an Image

# +
## Rotate the Image
img_rotated = img.rotate(180)

## Save the rotated Image
img_rotated.save("data/rotated_barr.png")
# -

# #### Transposing an Image

# +
## Transpose
transposed_img = img.transpose(Image.FLIP_LEFT_RIGHT)

## Save Transposed Image
transposed_img.save("data/transposed_barr.png")

StarcoderdataJupyterScriptsDedupFiltered