Image Processing in Python
$14.99
Minimum price
$24.99
Suggested price

Image Processing in Python

Processing raster images with the Pillow library

About the Book

Pillow is the most popular Python image processing library. It provides many of the features found in imaging applications like Photoshop or GIMP, that you can automate easily with Pythion code. This book explains how to use the library, in plain language and with lots of examples.

About the Author

Martin McBride
Martin McBride

Martin McBride is a software developer, specialising in computer graphics, sound, and mathematical programming. He has been writing code since the 1980s in a wide variety of languages from assembler through to C++, Java and Python. He writes for PythonInformer.com and is the author of Functional Programming in Python. He is interested in generative art and works on the generativepy open source project.

Table of Contents

  •  
    • Preface
      • Who is this book for?
      • About the author
      • Keep in touch
    • Introduction
      • Versions
      • Example sources on github
  • I Bitmap images
    • 1 Introduction to bitmap imaging
      • 1.1 What is a bitmap image?
      • 1.2 Spatial sampling
      • 1.3 Colour representation
      • 1.4 File formats
      • 1.5 Vector images
    • 2 Computer colour
      • 2.1 Visible light
        • 2.1.1 Frequency and wavelength
      • 2.2 What is colour?
        • 2.2.1 Non-spectral colours
      • 2.3 How we see colour
      • 2.4 The RGB colour model
        • 2.4.1 Displaying colour
        • 2.4.2 Representing RGB colours as a percentage
        • 2.4.3 Floating point representation
        • 2.4.4 Byte value representation
      • 2.5 Colour resolution
      • 2.6 Greyscale colour model
      • 2.7 The CMYK colour model
        • 2.7.1 The K component
      • 2.8 HSL/HSB colour models
      • 2.9 HSL variants
      • 2.10 Perceptual colour models
        • 2.10.1 CIE spaces
      • 2.11 Colour management
        • 2.11.1 Gamuts
    • 3 Bitmap image data
      • 3.1 Data layout
      • 3.2 8-bit per channel images
        • 3.2.1 24-bit RGB
        • 3.2.2 32-bit CMYK
        • 3.2.3 8-bit greyscale
        • 3.2.4 32-bit RGBA
      • 3.3 Bitmap data with fewer levels
        • 3.3.1 8-bit RGB
        • 3.3.2 16-bit RGB
        • 3.3.3 Dithering
      • 3.4 Bilevel images
      • 3.5 Bitmap data with more levels
      • 3.6 Palette based images
        • 3.6.1 Images with more than 256 colours
      • 3.7 Handling transparency
        • 3.7.1 Alpha channel
        • 3.7.2 Transparent palette entry
        • 3.7.3 Transparent colour
      • 3.8 Interlacing and alternate pixel ordering
    • 4 Image file formats
      • 4.1 Why are there so many formats?
      • 4.2 Image data and metadata
      • 4.3 Image compression
        • 4.3.1 Lossless compression
        • 4.3.2 Lossy compression
      • 4.4 Some common file formats
        • 4.4.1 PNG format
        • 4.4.2 JPEG format
        • 4.4.3 GIF format
        • 4.4.4 BMP format
      • 4.5 Animation
  • II Pillow library
    • 5 Introduction to Pillow
      • 5.1 Pillow and PIL
      • 5.2 Installing Pillow
      • 5.3 Main features of Pillow
    • 6 Basic imaging
      • 6.1 The Image class
      • 6.2 Creating and displaying an image
      • 6.3 Saving an image
      • 6.4 Handling colours
        • 6.4.1 Converting strings to colours
      • 6.5 Creating images
      • 6.6 Opening an image
      • 6.7 Image processing
      • 6.8 Rotating an image
      • 6.9 Creating a thumbnail
      • 6.10 Image modes
    • 7 Image class
      • 7.1 Example code
      • 7.2 Creating images
        • 7.2.1 Image.new
        • 7.2.2 Image.open
        • 7.2.3 copy
        • 7.2.4 Other methods
      • 7.3 Saving images
      • 7.4 Image generators
      • 7.5 Working with image bands
        • 7.5.1 getbands
        • 7.5.2 split
        • 7.5.3 merge
        • 7.5.4 getchannel
        • 7.5.5 putalpha
    • 8 ImageOps module
      • 8.1 Image resizing functions
        • 8.1.1 expand
        • 8.1.2 crop
        • 8.1.3 scale
        • 8.1.4 pad
        • 8.1.5 fit
      • 8.2 Image transformation functions
        • 8.2.1 flip
        • 8.2.2 mirror
        • 8.2.3 exif-transpose
      • 8.3 Colour effects
        • 8.3.1 grayscale
        • 8.3.2 colorize
        • 8.3.3 invert
        • 8.3.4 posterize
        • 8.3.5 solarize
      • 8.4 Image adjustment
        • 8.4.1 autocontrast
        • 8.4.2 equalize
      • 8.5 Deforming images
        • 8.5.1 How deform works
        • 8.5.2 getmesh
        • 8.5.3 A wave transform
        • 8.5.4 Other deformations
    • 9 Image attributes and statistics
      • 9.1 Attributes
        • 9.1.1 File size
        • 9.1.2 File name
        • 9.1.3 File format
        • 9.1.4 Mode and bands
        • 9.1.5 Palette
        • 9.1.6 Info
        • 9.1.7 Animation
        • 9.1.8 EXIF tags
      • 9.2 Image statistics
        • 9.2.1 Image histogram
        • 9.2.2 Masking
        • 9.2.3 Other Image statistics
        • 9.2.4 ImageStat module
    • 10 Enhancing and filtering images
      • 10.1 ImageEnhance
        • 10.1.1 Brightness
        • 10.1.2 Contrast
        • 10.1.3 Color
        • 10.1.4 Sharpness
      • 10.2 ImageFilter
      • 10.3 Predefined filters
      • 10.4 Parameterised filters
        • 10.4.1 Blurring functions
        • 10.4.2 Unsharp masking
        • 10.4.3 Ranking and averaging filters
      • 10.5 Defining your own filters
    • 11 Image compositing
      • 11.1 Simple blending
        • 11.1.1 Image transparency
        • 11.1.2 ImageChops blend function
        • 11.1.3 ImageChops composite function
      • 11.2 Blend modes
        • 11.2.1 Addition
        • 11.2.2 Subtraction
        • 11.2.3 Lighter and darker
        • 11.2.4 Multiply and screen
        • 11.2.5 Other blend modes
      • 11.3 Logical combinations
    • 12 Drawing on images
      • 12.1 Coordinate system
      • 12.2 Drawing shapes
        • 12.2.1 Drawing rectangles
        • 12.2.2 Drawing other shapes
        • 12.2.3 Points
      • 12.3 Handling text
        • 12.3.1 Drawing simple text
        • 12.3.2 Font and text metrics
        • 12.3.3 Anchoring
        • 12.3.4 Drawing multiline text
      • 12.4 Paths
        • 12.4.1 Drawing a path
        • 12.4.2 Transforming paths
        • 12.4.3 Mapping points
    • 13 Accessing pixel data
      • 13.1 Processing an image
      • 13.2 Creating an image
      • 13.3 Performance
    • 14 Integrating Pillow with other libraries
      • 14.1 NumPy integration
        • 14.1.1 Converting a Pillow image to Numpy
        • 14.1.2 Image data in a NumPy array
        • 14.1.3 Modifying the NumPy image
        • 14.1.4 Converting a NumPy array to a Pillow image
  • III Reference
    • 15 Pillow colour representation
      • 15.1 Hexadecimal colour specifiers
      • 15.2 RGB functions
      • 15.3 HSL functions
      • 15.4 HSV functions
      • 15.5 Named colours
      • 15.6 Example
      • 15.7 Image modes
    • More books from this author
      • Numpy Recipes
      • Computer Graphics in Python with Pycairo
      • Functional Programming in Python

The Leanpub 45-day 100% Happiness Guarantee

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

See full terms

Do Well. Do Good.

Authors have earned$10,909,613writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

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), EPUB (for phones and tablets) and MOBI (for 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, EPUB and/or MOBI files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub