I have a little issue with saving image with PIL. In my Django project I have the following save method:
from PIL import Image
class Photo:
image = models.ImageField(verbose_name='Photos', upload_to='media/date/photos/', help_text='Photo')
def save(self, *args, **kwargs):
super(Photo, self).save(*args, **kwargs)
image = Image.open(self.image)
image.save(self.image.path)
So, here I open the image with PIL and just save it in its default path. But looks like depending on image's EXIF data (metadata) PIL rotates the image before saving it.
For example, I took a picture of a person (I was holding the phone vertically, as normal) and when I saved it, the picture was rotated by 90 degrees to the left. What could be the matter here? It happens only if the Orientation was vertical, nothing bad happens to images taken horizontally. Please help and huge thanks in advance!