code: def rotate_exif(self):
          
          exif = self.image._getexif() or {}
          rotation = exif.get(TAGS['Orientation'], 1)
  
          rotations = {
              6: -90,
              3: -180,
              8: -270,
          }
          if rotation not in rotations:
              return
  
          self.image = self.image.rotate(rotations[rotation])
docs: Rotate image via exif information.
          Only 90, 180 and 270 rotations are supported.