def rotate(self, img):
        """ Rotate image if exif says it needs it """
        try:
            exif = image2exif.get_exif(img)
        except AttributeError:
            # image format doesn't support exif
            return img
        
        orientation = exif.get('Orientation', 1)

        landscape = img.height < img.width
        
        if orientation == 6 and landscape:
            print("ROTATING")
            return img.rotate(-90)

        return img
Rotate image if exif says it needs it