11👍
Glad you figured this out, but ImageKit may be able to help you out some still. Check out the Transpose processor (imagekit.processors.Transpose
). By default, it will use the metadata in the image, and rotate by that amount! Just be sure to list this processor first as subsequent processors will strip the metadata from the image.
9👍
To elaborate on matthewwithanm’s helpful pointer, the OP’s code would be tweaked to look like this:
profile_image = models.ImageField(upload_to='profile_images', default='profile_images/icon.png')
profile_icon = ImageSpecField(source='profile_image',
processors=[
processors.Transpose(),
processors.Thumbnail(width=72, height=72, crop=True)
],
format='JPEG',
options={'quality': 60})
ie, add a call to processors.Transpose()
with no arguments.
I had this problem with an original portrait-format image downloaded from Flickr. That image (taken on an iPhone) is in portrait format, and by default imagekit rotates it, in this particular case, 90 degrees anti-clockwise.
2👍
Okay, it turns out that it’s a problem with the images being uploaded, not anything with Django. Pictures that are taken on an iPhone can have phone orientation metadata that causes the browser to think the photo’s natural orientation is sideways. But, if I open that photo in Preview, rotate it left and then back to normal, and then save it again, there are no problems.
Feed image shows rotated in certain browsers
Surprise!
- How to measure the time profile of each django test?
- Django input element error css class
- How to send django objects to celery tasks?
- Can django-tastypie display a different set of fields in the list and detail views of a single resource?
- Unexpected error: replace() takes 2 positional arguments but 3 were given