简体   繁体   中英

How to process uploaded images in Django?

I've android application that uploads images to django server which hosted on 'pythonanywhere'. The android app works 100% it uploads images into the server and saves them correctly.

my problem is I want to do some image processing on the received pictures on the server side I know how to do image processing but ''I

The problem is I need to do an image processing code on the uploaded image right after the server catch the image and i don't know to how to do it in my code

I've looked on djagno files on the server and I found models.py

    from django.db import models

    class MyImage(models.Model):
       model_pic = models.ImageField(upload_to = '', default = 'none/no-img.jpg')

I guess the model_pic has the my uploaded photo

You can override the .save() model method, but your best bet would be to use a mature and stable image processing package such as django-imagekit . It has some great built-in image processors, and even lets you create your own.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM