In [2]:
! pip install pillow


Collecting pillow
  Downloading Pillow-4.0.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.4MB)
    100% |████████████████████████████████| 3.4MB 242kB/s 
Collecting olefile (from pillow)
  Downloading olefile-0.44.zip (74kB)
    100% |████████████████████████████████| 81kB 5.7MB/s 
Building wheels for collected packages: olefile
  Running setup.py bdist_wheel for olefile ... - done
  Stored in directory: /Users/driordan/Library/Caches/pip/wheels/20/58/49/cc7bd00345397059149a10b0259ef38b867935ea2ecff99a9b
Successfully built olefile
Installing collected packages: olefile, pillow
Successfully installed olefile-0.44 pillow-4.0.0

In [4]:
import PIL

In [5]:
from matplotlib.pyplot import imshow
import numpy as np
from PIL import Image

In [7]:
! ls mrss-maker/sample-images/


_D3R5961.jpg _D3R5966.jpg _D3R5973.jpg _D3R6131.jpg
_D3R5963.jpg _D3R5967.jpg _D3R6106.jpg subimg

In [ ]:
pil_im = Image.open('mrss-maker/sample-images/_D3R5967.jpg', 'r')
%matplotlib inline

In [12]:
from PIL import Image
import functools

In [13]:
def image_transpose_exif(im):
    exif_orientation_tag = 0x0112 # contains an integer, 1 through 8
    exif_transpose_sequences = [  # corresponding to the following
        [],
        [Image.FLIP_LEFT_RIGHT],
        [Image.ROTATE_180],
        [Image.FLIP_TOP_BOTTOM],
        [Image.FLIP_LEFT_RIGHT, Image.ROTATE_90],
        [Image.ROTATE_270],
        [Image.FLIP_TOP_BOTTOM, Image.ROTATE_90],
        [Image.ROTATE_90],
    ]

    try:
        seq = exif_transpose_sequences[im._getexif()[exif_orientation_tag] - 1]
    except Exception:
        return im
    else:
        return functools.reduce(lambda im, op: im.transpose(op), seq, im)

In [18]:
i = Image.open('../samples/wedding/20160523_162239.jpg')
j = Image.open('../samples/wedding/20160523_162251.jpg')
k = Image.open('../samples/wedding/20160523_162305.jpg')

In [25]:
k


Out[25]:

In [ ]: