Storing Pillow Image object to Django FileField(ImageField)

Requirement Image object in Pillow to File Object in Django and save them as FileField and FieldFile Methods From Stackoverflow ref: link import StringIO from django.core.files.uploadedfile import InMemoryUploadedFile # Create a file-like object to write thumb data (thumb data previously created # using PIL, and stored in variable 'thumb') thumb_io = StringIO.StringIO() thumb.save(thumb_io, format='JPEG') # Create a new Django file-like object to be used in models as ImageField using # InMemoryUploadedFile....

April 4, 2022 · 1 min · Jaaved Khan