django-imagekit
django-imagekit copied to clipboard
Possible to prevent auto-rotation/flip?
An ImageSpecField
with a ResizeToFit
processor will be auto-rotated 90 degrees if the ResizeToFit
dimension "ratio" contradicts the original uploaded image height/width ratio.
Is it possible to prevent this auto-rotation?
class Image(models.Model):
is_primary = models.BooleanField(
blank=True,
default=False,
)
image = models.ImageField(upload_to="uploads/")
thumbnail = ImageSpecField(
source="image", processors=[ResizeToFit(550, 400)], format="JPEG", options={"quality": 60}
)
caption = models.CharField(blank=True, max_length=128)
If I uploaded an image 3024 pixels width x 4032 pixels height, this image has a height larger than width, so will be flipped, since the ResizeToFit
uses a slightly larger width than height.
(Let me know if this would be better asked in https://github.com/matthewwithanm/pilkit.)
Hello,
I'm looking at the code at pilkit/processors/resize.py and can't see a logic for explicitly rotating an image. I'm not sure if it is coming from Pillow somehow if in the metadata of the image there is information about the orientation of the image (if it was taken from phone for example).
@bsolomon1124 Have you found some sort of workaround? I'm also experiencing this.
Hi! I experienced the same issue, adding Transpose(),
before all processors helped me
https://github.com/matthewwithanm/django-imagekit/issues/238#issuecomment-21569897
Based on the comment by @allburov I think that the current issue is duplicate of #238 and I'll close the issue.