Rotating an image with orientation specified in EXIF using Python without PIL including the thumbnail

后端 未结 6 1283
太阳男子
太阳男子 2020-12-02 09:10

I have the following scenario:

  • I am sending an image from iPhone along with the EXIF information to my Pyhon socket server.
  • I need the image to be pro
6条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 10:06

    https://medium.com/@giovanni_cortes/rotate-image-in-django-when-saved-in-a-model-8fd98aac8f2a

    This blog post explains it clearly. Just make sure you try keeping the @receiver.. code in forms.py or models.py as I got cannot import model/view errors .

    keep the rotate_image method in models.py & @receiver.. code also in models.py.

    I also got errors like No such directory. Just make sure full_path is set correctly to media folder.

    I used this line

    fullpath = os.path.join(os.path.dirname(BASE_DIR)) + instance.fimage.url

提交回复
热议问题