Pillow: Image Processing with Python
Minimum price
Suggested price

Pillow: Image Processing with Python

About the Book

The Python Imaging Library allows you to use Python to edit photos. The Pillow package is the latest version of the Python Imaging Library. You can use Python to batch process your photos using Pillow.

In this book, you will learn about the following:

  • Opening and saving images
  • Extracting image metadata
  • Working with colors
  • Applying image filters
  • Cropping, rotating and resizing
  • Enhancing images
  • Combining images
  • Drawing with Pillow
  • ImageChops
  • Integration with GUI toolkits

You'll learn all these things and more in this book. Soon you will be able to edit photos like a professional using the Python programming language!

About the Author

Michael Driscoll
Michael Driscoll

Michael has been programming with Python since 2006. He is the author of the popular Python blog, The Mouse Vs. the Python. Michael has been a technical reviewer for Packt Publishing and No Starch Press.  He is also a contributor on Real Python.

He also co-authored The Essential Core Python Cheat Sheet for DZone.

Michael released his first book, Python 101, June 3rd, 2014. He wrote the follow up, Python 201: Intermediate Python and published it in the summer of 2016. He is also the author of wxPython Cookbook from Apress as well as Python Interviews from Packt Publishing.

Michael is currently working on some new books as well.

Bundles that include this book

Bought separately
Bundle Price

Table of Contents

  • About the Technical Reviewers
    • Ethan Furman
    • Alessia Marcolini
  • Acknowledgments
  • Introduction
    • Who is this book for?
    • About the Author
    • Conventions
    • Requirements
    • Book Source Code
    • Reader Feedback
    • Errata
    • Cover Art
  • Chapter 1 - Pillow Basics
    • Opening Images
    • Saving Images
    • Changing Compression During Saving
    • Changing DPI During Saving
    • Reading Methods
    • Creating Thumbnails
    • Creating an Image Viewer
    • Wrapping Up
  • Chapter 2 - Colors
    • Understanding Color
    • Using Pillow to Get RGB Values
    • Getting Colors from Images
    • Changing Pixel Colors
    • Converting to Black and White
    • Creating 4-Color Photos
    • Creating a Sepia Photo
    • Creating an Image Converter GUI
    • Wrapping Up
  • Chapter 3 - Getting Image Metadata
    • Getting Exif Tag Data
    • Getting GPS Exif Data
    • Getting TIFF Tag Data
    • Creating an Exif GUI
    • Wrapping Up
  • Chapter 4 - Filters
    • The BLUR Filter
    • The CONTOUR Filter
    • The DETAIL Filter
    • The EDGE_ENHANCE Filters
    • The EMBOSS Filter
    • The FIND_EDGES Filter
    • The SHARPEN Filter
    • The SMOOTH Filters
    • RankFilters
    • MultiBand Filters
    • The BoxBlur Filter
    • The GaussianBlur Filter
    • The Color3DLUT Filter
    • The UnsharpMask Filter
    • Using Filters in a GUI
    • Wrapping Up
  • Chapter 5 - Cropping, Rotating & Resizing Images
    • How Coordinates Work in Images
    • Cropping Images
    • Rotating Images
    • Mirroring Images
    • Resizing Images
    • Scaling Images
    • Creating an Image Rotator GUI
    • Wrapping Up
  • Chapter 6 - Enhancing Images with ImageEnhance
    • Adjust Color Balance
    • Adjust Image Contrast
    • Adjust Image Brightness
    • Adjust Image Sharpness
    • Enhancing Photos with a GUI
    • Wrapping Up
  • Chapter 7 - Combining Images
    • Pasting an Image
    • Tiling Images
    • Concatenating Images
    • Watermarking an Image
    • Compositing Images
    • Blending Images
    • Creating a Watermark GUI
    • Wrapping Up
  • Chapter 8 - Drawing Shapes
    • Common Parameters
    • Drawing Lines
    • Drawing Arcs
    • Drawing Chords
    • Drawing Ellipses
    • Drawing Pie Slices
    • Drawing Polygons
    • Drawing Rectangles
    • Creating a Drawing GUI
    • Wrapping Up
  • Chapter 9 - Drawing Text
    • Drawing Text
    • Loading TrueType Fonts
    • Changing Text Color
    • Drawing Multiple Lines of Text
    • Aligning Text
    • Changing Text Opacity
    • Learning About Text Anchors
    • Creating a Text Drawing GUI
    • Wrapping Up
  • Chapter 10 - Channel Operations
    • ImageChop Aliases
    • Adding Images
    • Using ImageChops.darker()
    • Using ImageChops.lighter()
    • Finding Differences in Images
    • Inverting Images
    • Using Soft Light on Images
    • Using Hard Light on Images
    • Overlay Images
    • Creating a Blending GUI
    • Wrapping Up
  • Chapter 11 - The ImageOps Module
    • Applying Automatic Contrast
    • Colorizing Photos
    • Padding an Image
    • Adding a Border
    • Removing a Border
    • Scaling an Image
    • Equalizing the Histogram
    • Sizing and Cropping an Image
    • Flipping an Image
    • Mirroring an Image
    • Inverting an Image
    • Posterize an Image
    • Solarize an Image
    • Transpose Image Using Exif Orientation
    • Creating an ImageOps GUI
    • Wrapping Up
  • Chapter 12 - Pillow Integration with GUI Toolkits
    • Kivy
    • PySimpleGUI
    • PyQt
    • Tkinter
    • wxPython
    • Wrapping Up
  • Chapter 13 - Alternatives to Pillow
    • NumPy
    • OpenCV
    • Wand (ImageMagick Bindings)
    • Cropping with Wand
    • Wrapping Up
  • Chapter 14 - Batch Processing
    • Creating a Batch CLI Application
    • Running the Batch Application with Threads
    • Modularizing Your Code
    • Adding a GUI
    • Wrapping Up
  • Afterword

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub