mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 23:00:18 +00:00
Added in examples and link to tutorial for imaging.rst.
This commit is contained in:
@@ -28,3 +28,32 @@ After that, it's straightforward:
|
||||
.. code-block:: console
|
||||
|
||||
$ pip install Pillow
|
||||
|
||||
Example
|
||||
~~~~~~~
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from PIL import Image, ImageFilter
|
||||
#Read image
|
||||
im = Image.open( 'image.jpg' )
|
||||
#Display image
|
||||
im.show()
|
||||
|
||||
#Applying a filter to the image
|
||||
im_sharp = im.filter( ImageFilter.SHARPEN )
|
||||
#Saving the filtered image to a new file
|
||||
im_sharp.save( 'image_sharpened.jpg', 'JPEG' )
|
||||
|
||||
#Splitting the image into its respective bands, i.e. Red, Green,
|
||||
#and Blue for RGB
|
||||
r,g,b = im_sharp.split()
|
||||
|
||||
#Viewing EXIF data embedded in image
|
||||
exif_data = im._getexif()
|
||||
exif_data
|
||||
|
||||
There are more examples of the Pillow library
|
||||
`here <http://pillow.readthedocs.org/en/3.0.x/handbook/tutorial.html>`_.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user