How to make django-photologue autorotate image with info from EXIF? -
i need change orientation of image according info in exif on upload. there "standard" way this? im trying patch models now, not sure right way.
well, did file photologue/models.py:
image_exif_orientation_map = { 6: 0, 3: 2, 8: 3, 1: 4, } def pre_cache(self): if self.exif.get('orientation', 1) not none: im = image.open(self.image.path) im = im.transpose(image_exif_orientation_map[self.exif.get('orientation', 1)]) im.save(self.image.path) cache = photosizecache() photosize in cache.sizes.values(): if photosize.pre_cache: self.create_size(photosize)
Comments
Post a Comment