Files referenced in the article:
Bulk Orientation Fix

Unfortunately it is often the case that pictures taken with a mobile device (or from anything, really) are rotated 90 degrees clockwise or counter-clockwise when stored, which is obviously not optimal. It's even less optimal when we consider that our platform really wants to see them right-side up.

Fortunately, we have a solution for this! The following snippet of Python code will loop through a local directory of images on your computer and turn all of them to the correct orientation, which will then allow you to upload them to us without any snags. The files will be saved with the same name in the same directory where they are currently located.

Requirements: os, PIL modules
Optional: tqdm module

from tqdm import tqdm_notebook as tqdm # optional. Adds a progress bar to the for loop
import os
from PIL import Image
from PIL.ExifTags import TAGS

# replace below with image directory
image_dir = '/this/is/your/local/directory'

if image_dir[-1] != '/':
  image_dir = image_dir + '/'

for image in os.listdir(image_dir):

  image_path = image_dir + image
  im =
  for key,value in im._getexif().iteritems():
    if TAGS.get(key) == 'Orientation':
      orientation = value
  if orientation == 1:
  if orientation == 3:
    im = im.rotate(180)
  if orientation == 6:
    im = im.rotate(270)
  if orientation == 8:
    im = im.rotate(90)
Did this answer your question?