django_optimized_image
django_optimized_image copied to clipboard
Image Rotating
I'm trying to resize images in specific resolution (200x300) and upload them to my project. If the large images i've uploaded are exact multiples of the scale such as 600x900 and 1200x1800, there isn't a problem. But, if they are not round numbers, the resulting images are rotated 90 degrees. ( like 206x309 and 1255x1883 which are still multiples of the scale ). I' couldn't solved this by thumbnails and covers methods.
I can't send commit now because of some technical problems, But i'm writing changes to help anyone would face that problem. I changed some fields below and problem is solved.
--> lib/site-packages/image-optimizer/utils.py/
(+) from PIL import Image, ImageOps (+) from PIL import ExifTags
if OPTIMIZED_IMAGE_METHOD == 'pillow': image = Image.open(image_data) (+) lastimage = ImageOps.exif_transpose(image) bytes_io = BytesIO() (+) lastimage .save(bytes_io, "JPEG")