avoid uselsse exif() calls
This commit is contained in:
parent
96afb9cc0b
commit
1b6eb7d4a0
1 changed files with 4 additions and 3 deletions
|
|
@ -415,14 +415,15 @@ class ImageModel(models.Model):
|
||||||
# Save the original format
|
# Save the original format
|
||||||
im_format = im.format
|
im_format = im.format
|
||||||
# Rotate if found & necessary
|
# Rotate if found & necessary
|
||||||
|
exif = self.exif()
|
||||||
if (
|
if (
|
||||||
"Image Orientation" in self.exif()
|
"Image Orientation" in exif
|
||||||
and self.exif().get("Image Orientation").values[0]
|
and exif.get("Image Orientation").values[0]
|
||||||
in IMAGE_EXIF_ORIENTATION_MAP
|
in IMAGE_EXIF_ORIENTATION_MAP
|
||||||
):
|
):
|
||||||
im = im.transpose(
|
im = im.transpose(
|
||||||
IMAGE_EXIF_ORIENTATION_MAP[
|
IMAGE_EXIF_ORIENTATION_MAP[
|
||||||
self.exif().get("Image Orientation").values[0]
|
exif.get("Image Orientation").values[0]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
# Resize/crop image
|
# Resize/crop image
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue