Saturday, September 10, 2016

Re: is it possible to manipulate image in PIL after uploading directly by its "request.FILES.GETLIST(FORMFIELD)" address not the saved picture on hard disk

thanks for answering
with your help solved the problem
if any one get to this problem, here is how i solved it:

            filelist = request.FILES.getlist('uploadimage')   #first get list of your uploaded file object as list
            for imgfile in filelist:                                       # iterate over your list and give each uploaded photo object to your PIL
                  img = Image.open(imgfile)                       # you can open your uploaded photo object as normal picture like this
                  #your manipulation and changes on picture comes here
                  img.save('MypicName.jpeg')  #finaly save your picture like this

On Friday, August 26, 2016 at 8:35:21 PM UTC+4:30, Asad Jibran Ahmed wrote:
Hi,
 Every object in `request.FILES` is actually a file *liike* object that you can use for processing. I guess you can use something like `PIL.Image.frombytes` with the `request.FILES[filename].read()` data.

Pillow (PIL Fork) documentation for the `frombytes` method: https://pillow.readthedocs.io/en/3.3.x/reference/Image.html#PIL.Image.frombytes

Hope that helps.
Regards,


On Fri, Aug 26, 2016 at 7:46 PM, ali Eblice <alie...@gmail.com> wrote:
Hello Friends
is it possible to manipulate image in PIL after uploading directly by its "request.FILES.GETLIST(FORMFIELD)"  address not the saved picture on hard disk?

I wrote a function for manipulating  but its only working with  " Image.open('a.jpg') " but i don't want to save image after uploading and then opening it for manipulating , is it possible to manipulate image with its "request.FILES" object address?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9b6734c8-4530-42b3-b791-99bbce020b32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0323b1af-6ada-4daa-9d47-f9eba95a8b43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment