code: def add_orientation(self, orientation):
          
          if not orientation in range(1, 9):
              print_error(
                  "Error value for orientation, value must be in range(1,9), setting to default 1")
              self._ef['0th'][piexif.ImageIFD.Orientation] = 1
          else:
              self._ef['0th'][piexif.ImageIFD.Orientation] = orientation
docs: Add image orientation to image.