python-pillow / podcast-answers

Podcast.__init__ Q&A

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Podcast.__init__ Interview

Gathering questions and answers for Podcast.__init__ interview scheduled for tonight @ 8 EDT. I'm going to add questions and answers here and create issues for questions that may be enhanced by additional commentary from the Pillow Team & community. Pillow Team members and community are welcome and encouraged to add comments to help improve answers (where applicable).

How did you get introduced to Python?

In the early 2000s I was working at the National Institutes of Health in Bethesda, MD, USA (NIH) as a System Administrator and my group needed a website. A neighboring group was using Plone and I decided to copy their approach. Plone is written in Python & built on top various Zope technologies written in Python & C. To customize Plone, you had to know a little Python, so that was my introduction. (Incidentally, that site is still running: https://afni.nimh.nih.gov/.)

What were you working on that led you to forking the Python Image Library (PIL)

By the mid-2000s, I had quit my job at NIH to do Plone consulting fulltime. In 2010, I was doing Django consulting at National Geographic in DC and I remember coming in the next day and saying "I forked PIL last night." My colleagues' reaction was yawn and rightfully so, because no one thought about what Pillow could become, including me. I created the fork because I was annoyed with my inability to install PIL from PyPI. The PIL package was hosted off site; worse, it had flaws no one was willing or able to address upstream. This led to the proliferation of (what I felt to be annoying and inelegant) forks not hosted on PyPI e.g.:

So I thought, if we're going to use these forks, let's just "go all-in" and publish the fork to PyPI. So that's what I did. Incidentally, the fork was based on work done by a "Plone guy" (at the time) named Hanno Schlicting. He addressed one major annoyance at the time (with namespace collision):

import Image

With Hanno's PIL, it was only possible to import Image from PIL:

from PIL import Image

At the time, I called Pillow "a packaging fork".

What does Fredrik Lundh (author of PIL) think of Pillow?

My favorite story to tell about Fredrik involves a comment he made in response to my introduction to Pillow on image-sig. He said something like "A lot of people complain; at least someone is doing something about it." Or at least that's roughly how I interpret his comment. His exact words (and more context) are here:

When you first forked the PIL project did you think that you would still be maintaining and updating that fork by now?

No. I didn't think about it at all. I just knew that my Plone installations were going to be awesome. When Pillow caught on, I was really happy others found it useful. Now-a-days, most of the day to day operations of Pillow development are performed by the Pillow Team and global community without my intervention. I pop in about once per quarter to make sure releases go according to plan, and to prune repositories and issues. Additionally, I just registered python-pillow.org so we could ensure that security-related emails make it to the right members of the team.

Can you describe what PIL and now Pillow are and what kinds of use cases they support?

Sure. PIL allows Python programmers to perform complex image manipulation operations without having to know the details and algorithms involved in performing such operations, e.g.:

  • Viewing EXIF data embedded in image
  • Splitting the image into its respective bands, i.e. Red, Green, and Blue for RGB
  • Applying a filter to the image

As a Python Web Developer, I use Pillow to manipulate images in my web applications. In some cases, that manipulation is seamless (i.e. the image manipulation code is already written; e.g. Plone uses Pillow to enable content editors to manipulate images on their website). In other cases, I write Pillow code to perform some manipulation that is needed in my application (e.g. create thumbnails).

Discussion #1

What architectural patterns does Pillow use to make image operations fast and flexible? Have you found the need to do any significant refactorings of the original code to make it compatible with modern uses and execution environments?

PIL has about 30K lines of C code, which contain various modules for imaging manipulation, that are made available from Python via C Extensions. The biggest refactor was probably when we added Python 3 compatibility. That's when we really started changing things, and Pillow became more than just a packaging fork.

Discussion #2

I have seen Pillow used in computer vision contexts. What are some of the capabilities of the library that lend themselves to this purpose?

For as much as computer vision involves basic image processing PIL can help e.g. cropping, resizing, rotating and changing formats. Beyond that, you'll likely need more powerful tools like matplotlib, OpenCV, etc..

Discussion #3

What kinds of special knowledge or experience have you found to be necessary for understanding and extending the routines in the library and for adding new capabilities?

Discussion #4

C Programming Language, Python Distutils C Extensions.

Have you kept up to date with newer image formats, such as webp? Are there any image formats that Pillow does not support that you would like to see added to the project?

Yes. Read/write support for both WebP and JPEG2000 have been added to Pillow. And since I returned to NIH in 2013, I'd like to see some medical image formats supported e.g. DICOM, NIfTI.

Discussion #5

What are some of the most interesting or innovative uses of Pillow that you have seen?

My favorite innovation is Jeremy Kun's Random Psychedlic Art made with PIL

Discussion #6

How does Pillow compare to libraries with a similar purpose such as ImageMagick?

When I think of ImageMagick, I think of command line tools for image manipulation, which Pillow is not.

Discussion #7

What do you have planned for the future of Pillow?

More quarterly releases, security fixes, code cleanup, feature additions, improved documentation, bigger community.

About

Podcast.__init__ Q&A


Languages

Language:Makefile 100.0%