Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

opening aws images with pillow

>>> from django.core.files.storage import default_storage as storage
>>> from PIL import Image
>>> import StringIO
>>> i = storage.open('ImageToCreate.jpg','w+')
>>> m = storage.open('ImageAlreadyOnS3.jpg','r')
>>> im = Image.open(m)
>>> im = im.resize((640,360),3)
>>> sfile = StringIO.StringIO() #cStringIO works too
>>> im.save(sfile, format="JPEG")
>>> i.write(sfile.getvalue())
>>> i.close()
>>> m.close()
Comment

PREVIOUS NEXT
Code Example
Python :: How determine if a number is even or odd using Recursive Inner Function 
Python :: threading pass keyword args example 
Python :: py decorateur 
Python :: Collections module: deques and queues 
Python :: double linked list python 
Python :: python write multiline string to file 
Python :: Python Tkinter Entry Widget Syntax 
Python :: how to get each word in a string in python 
Python :: The get() method on Python dicts and its "default" arg 
Python :: python equivalent linkedhashmap 
Python :: python datetime toordinal 
Python :: tables in django 
Python :: Joining String And Variable 
Python :: gensim word2vec loop keyed vector 
Python :: convert set to list python time complexity method 4 
Python :: Determining Web Address In Django 
Python :: python keyerror 0 
Python :: 0 in python 
Python :: como poner python 3 en la terminal mac 
Python :: How to run smtp4dev as a dotnet global tool 
Python :: Find Resolution of JPEG Image 
Python :: images in pygame 
Python :: python networkmanager tutorial 
Python :: reassign variable python 
Python :: mylist = [“hello”, “bye”,”see ya”,”later”] phrase = mylist[1] 
Python :: how to find left top width and height on an image using python 
Python :: QMenuBar pyqt 
Python :: print("python is good") 
Python :: Improve the Request Add Headers to Requests 
Python :: pip set mirror site 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =