<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>pillow on Jaaved Ali Khan</title><link>https://jaaved.netlify.app/tags/pillow/</link><description>Recent content in pillow on Jaaved Ali Khan</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sat, 14 Jan 2023 20:07:11 +0400</lastBuildDate><atom:link href="https://jaaved.netlify.app/tags/pillow/index.xml" rel="self" type="application/rss+xml"/><item><title>Image object in Pillow</title><link>https://jaaved.netlify.app/notes/202104061056-image_object_in_pillow/</link><pubDate>Sat, 14 Jan 2023 20:07:11 +0400</pubDate><guid>https://jaaved.netlify.app/notes/202104061056-image_object_in_pillow/</guid><description>Summary # https://pillow.readthedocs.io/en/stable/reference/Image.html
PIL.Image.open(fp, mode=&amp;lsquo;r&amp;rsquo;, formats=None)
fp – A filename (string), pathlib.Path object or a file object. classPIL.Image.Image[source] # This class represents an image object. To create Image objects, use the appropriate factory functions. There’s hardly ever any reason to call the Image constructor directly.
open() new() frombytes() An instance of the Image class has the following methods. Unless otherwise stated, all methods return a new instance of the Image class, holding the resulting image.</description></item><item><title>Storing Pillow Image object to Django FileField(ImageField)</title><link>https://jaaved.netlify.app/notes/202104061159-storing_pillow_image_object_to_django_filefield_imagefield/</link><pubDate>Mon, 04 Apr 2022 10:31:54 +0300</pubDate><guid>https://jaaved.netlify.app/notes/202104061159-storing_pillow_image_object_to_django_filefield_imagefield/</guid><description>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 &amp;#39;thumb&amp;#39;) thumb_io = StringIO.StringIO() thumb.save(thumb_io, format=&amp;#39;JPEG&amp;#39;) # Create a new Django file-like object to be used in models as ImageField using # InMemoryUploadedFile.</description></item></channel></rss>