Using seek should do the trick. It's a function, taking an offset as its first value and a flag as second value indicating from where to apply the offset. It return the position after the seek operation. So io_object.seek(0, os.SEEK_END) will tell you the number of characters in io_object. That should be equal to the size.
2016-09-10 9:49 GMT+02:00 ali Eblice <[email protected]>: > Hi everybody > I wanted to save PIL image object in model ImageField , but before doing > that i have to convert PIL image object to django file-like object > I found a solution with stringIO but the problem is that in this solution > "io_object.len" is used and "len" is not available in pythin3 > here is the link to solution: > http://stackoverflow.com/questions/3723220/how-do-you-convert-a-pil-image-to-a-django-file > > So how can i convert PIL image object to django file-like object for saving > in model type ImageField > best regard > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > 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/a4685c6c-f136-4d5f-8230-edb08fb30c36%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Cordialement, Coues Ludovic +336 148 743 42 -- 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 [email protected]. To post to this group, send email to [email protected]. 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/CAEuG%2BTbo6hP4tYsrXA38cM7EZDjJO7OSVLCwd3e%3DL%2B-u_Bg5SQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

