- Podcasts
- The Python Show
- 43 - Python Image Processing with Pillow
About this episodeIn this episode, Mike has Alex Clark on the show. Alex is the leading developer of the fork of the Python Imaging Library (PIL), known as…
In this episode, Mike has Alex Clark on the show. Alex is the leading developer of the fork of the Python Imaging Library (PIL), known as Pillow.
We chatted about the following topics:
* The origins of Pillow
* Lessons learned in open source development
* Surprising use cases for Pillow
* AI and Pillow
* and much more!
Show Links
* Django - https://www.djangoproject.com/
* Wagtail - https://wagtail.org/
* Faker - https://github.com/joke2k/faker
* django-allauth - https://allauth.org/
* django-extensions - https://github.com/django-extensions/django-extensions
* django-sql-explorer - https://www.sqlexplorer.io/
* logfire - https://pydantic.dev/logfire
* Pillow demo - https://github.com/python-pillow/pillow-demo
* https://www.jeremykun.com/2012/01/01/random-psychedelic-art/
* https://github.com/readme/featured/nasa-ingenuity-helicopter
* Alex’s band - https://headstraight4life.com/
Get full access to The Python Show at www.pythonshow.com/subscribe
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
43 - Python Image Processing with Pillow
And then I didn't really think about computers for about 10 years until I was at Loyola University in Maryland. And I happened to walk past the Unix lab and there was digital deck stations with like 20 inch monitors. And I saw people, you know, sitting there in the Unix lab. And I immediately switched my major to computer science from accounting to and never looked back. So back in the day in the 90s, I wrote C and went through all the CS requirement courses. And then Python happened in the early 2000s with when I was doing clone CMS development. And then I just fell in love with Python.
Still Plone Conference every year, still an active community. I just switched my stack at some point. I didn't want to deal with the, something didn't quite, things like Django and like actually Pyramid, you know, back in the day, coming out of my Plone years, just felt like I was closer to the situation or, you know, closer to the application that I wanted to. Nothing against Plone, and I still actually fire it up from time to time. And I actually have a client right now who's moving his Oak site, so I still kind of dabble, but I feel at home in Django now after like 10 years.
Yeah, for this one, I went through my Django favorites. Okay. So I do a lot of Django and Wagtail. Django is the framework. Wagtail is the CMS, content management system. And the first one I came across was this library faker that I absolutely love. I'm not entirely sure why, like for generating fake data. And I use it a lot when in development, when I have a form and I just want the data in it. Nothing's more annoying to me than being in development and not being able to save the form because I have to know what the input is. That drives me nuts. I love Faker. I love AllAuth, which takes care of many authentication problems out of the box as an add-on to the Django framework and Wagtail. It's blurb. They say free, secure, well-integrated, reusable authentication solution covering all functionality related to local and social user accounts. Multi-factor. So all that stuff they have code for. And let's see what else. Django Extensions has this graph model thing that I really like for showing you this enormous complex thing of all your models. And then last two I have are new products i would say people trying to market their commercialize their offering one's called django sql explorer which was really interesting in which you can install this thing in your django and then write sql queries and then save them and run them whenever you want i thought that was pretty and the nice the interface was nice and then log fire i was talking to somebody recently who said you know Pydantic. And I was like, no, I kind of know type enforcement. And then I just went down this Pydantic rabbit hole and found that the Pydantic guy started a company in which he promises to deliver, you know, the developer first experience for a, uh, century like offering called log fire. And sure enough, it's, I, you know, I, I installed it and it, I was impressed in their delivery on that promise. It's in beta, so you can go to LogFire and start using it. And there were some impressive developer-y things about it, for sure.
Yeah, Datadog is basically, it consumes all of your logs and has a complicated UI system on top of it. So you send your logs up to it and you basically pay X number of, depending on the volume of logs and how many users you want to connect to it, things like that. It's not really made for Python necessarily.
Yeah, so 2010, I was doing clone CMS development, and I was super annoyed with the deployments. The image processing library pill was deployed separately from everything else. So everything was on PyPy, except the pill library. And it was required. It was a requirement. So you couldn't run the CMS without running this thing. So, I mean, I looked at many, many deployments where... you know, the build out, which was Windows INI style configuration was like, you know, saw this stuff and then go get the image library over here. And so I think this slowly drove me insane until I, because people were repackaging it. And I referenced the people who did the actual work on the repackaging too. So one night at like three in the morning, I just took the repackaging from somewhere and, and created a GitHub for it and checked it in and did a release and called it Pillow and then published an email to the image sig, 22nd of July, saying, hey, I did this and I'm going to sleep. And there's all kinds of details that from 2010 to 2013 that are interesting. Then in 2013, Python support came along by a volunteer and we merged it. And that's what it was like for three years, it was like me and some other people whose PRs I would merge. Then when I merged the Python 3 support PR, I would say at that point, it just kind of blew up. And I think a few years later, I was like, oh, wow. Actually, I remember 2013 going somewhere and someone asking me if I was that Alex. And I'm like, yeah, okay. Fast forward again to 2018. This is how it came about. I'm kind of answering a little bit more, but the late 2018, we got funding, which was also the interesting milestone in the whole timeline, which was huge in that as a musician, it felt like getting a record deal, that sort of thing. It felt really important. So now, what, four or five years later, I think we started in 2019, It's four of us who get paid every month to keep pillowing. And we split it evenly. And it just works. So thank you, Tidelift, for that funding.
Yeah, it's, it's, I have the since this, since that happened, I have the dream that it is a living, you know, wage amount. And I think maybe they have some people that approach that, but, you know, based on their algorithm, and, and, you know, so there's, there's someone has to market and provide value for the for the open source. And that's, yes. you know, that's what needs to happen. I don't, I'm not one of those, you know, you have to donate.
Yeah, I think hanging out with people like entrepreneurs or just business people sometimes, it just gives you ideas. Just like you hang out with other senior developers and some junior developers. You'll get... ideas from both sides right help you improve so are there any lessons you've learned uh while creating pillow or maintaining it over the years yeah i think we
drifted into a couple lessons there the first one that i wrote down that i thought was meaningful was that it doesn't have to be stressful so i remember in my blown cms days i was doing a lot of open source development and it was super stressful Pillow is the least stressful open source thing I've ever done. And I think that that's meaningful. And it's a good example of that it doesn't have to be stressful. And the second one I wrote down was that we just talked about, which is there needs to be marketing of these libraries for the developers so that they can earn a living wage. That lesson is very fresh for me now. And the last thing is image processing. Like I think I've dabbled in actually using the library over the years, but I did a demo where I went through the pill handbook tutorial and did all the real code for all the image processing. uh, fundamentals or, you know, introductory examples. And that was actually kind of thrilling for me.
It's frustrating to, to know what you want to do, whether it's, you know, supporting a library, working on a project, whatever it is that is, you know, there's value like Pillow. I know there's tremendous value to being delivered, a disproportionate amount of value. I mean, I talk to people all the time that tell me, you know, we're using it here, you know, big companies were using it and So that's one of the frustrating part. And the answer is marketing, but that's not easy either. So the average open source developer that wants to code and contribute needs advocates for them. And in addition to getting paid for PIL, I also advocate for lifting. the more people that are Tidelift customers, and I don't think Tidelift is unique in this. I think any company can do it, but they just happen to be doing it. And I think that we need more of those companies. So I advocate on behalf of lifters so that companies become clients and lifters can be lifted.
It's also hard that I look around and I'm like, you know, hey, I just updated this Sphinx documentation theme. Maybe I can, you know, make a living on this. Maybe this can earn money. And Tidelift has like an API where you can go see if this, you know, whatever library you can think of can be monetized. So they've done some work to calculate whether or not they think they can get customer support to support that library. So that's hard too. things that go through my head, like, you know, Oh, well, you know, maybe if I get everyone to start using this theme on their blog or something, then I make, you know, a hundred dollars a month or something. I mean, just, yeah, there's a lot of brick walls, I would say to, to open source.
It's the most meaningful process is actually to advocate on behalf of large company or on behalf of lifters and Tidelift. So you would say, for example, to your company, hey, you need to go get a Tidelift subscription because we are using this library and these guys are supporting it. that's the most meaningful way at the moment. And in fact, it gets harder after that. Like you can't just give me money or something. And if I, but if I was the pydantic guy, maybe you could give me, you know, venture capital, but I don't have that idea.
Jeremy Kuhn. You can look that up. And then recently, actually in 2016, one of our developers, Eric, created an issue about additional multi... channel image support in pillow and this is issue 1888 and this would allow more interesting use cases by both gis and vfx communities people doing you know geolocation stuff as well as visual effects for movies and tv hit a wall with with pillow where it does it goes right up to some line where it supports know some limited number of channels for some operations and if it had these additional features it could do a lot more so i'm actually thinking a lot about that in the same way that you know adding python 3 support was meaningful i'm thinking about how to help with that there's an event later this month on the 30th where we're gonna some people are gonna meet and talk about that the a meetup called moco makers And then lastly, the NASA Ingenuity helicopter badge that showed up on my profile. So apparently Pillow is on Mars. And since that happened, this was 2021 or so, you tell people, hey, it's on Mars. I actually looked for it in all their GitHub repositories. I couldn't find like nobody had it in their requirements. So we have the badge. All the developers have the badge. But I would love it if somebody out there said, oh, well, it was used... I would love more detail on that because it's a super interesting use case, but I can't find... They apparently didn't publish examples of it in use on the helicopter, which I think is not alive anymore. I don't remember. Huh.
Yeah, that's a good one, too. I love to look at the stats, whether they're meaningful or meaningless is debatable. And URL Lib 3 by Seth is somewhere in the... was it 2 billion downloads per over three months or something and pillows in the 500 million. So we're, you know, like half a billion. We're like, yeah, we're getting there, but I think, yeah, I think it's, it's meaningful. ish you know i mean it you can correlate it with if you went around the world and said hey do you use you know this library and they all said no and then you could say oh well it's you know it's jenkins it's just downloading it or something yeah
Matplotlib, a lot of them may optionally work with it. We see a lot of NumPy questions on the Pillow, on GitHub issues in the Pillow repo. And there's probably a library too that is well known that relies on it, but I can't think of it offhand. And it's not such an over the top relationship that we know about it and think about it a lot.
It's mostly, the project mostly runs itself. And by that, I mean, keeping up with Python, it tracks the Python code. release schedule very closely. So the most interesting thing is that it is released quarterly with bug fixes and new Python version support. The issue 1888 that I want to work on, I think, is the most interesting to me in which we possibly use an Apache thing, I can't remember the name of it, that lets us write Python that binds to C without having to write C code to add more of this multi-channel support that could come out or that could materialize in some form, maybe not a release, but this year-ish.
Yeah, it seems like an open-ended, you know, loaded-ish question, but obviously designed to spark the discussion. And so, no, I don't think so. But I do think that, or I know it can already write Python code, you know, for... for image processing. So that's kind of cool. I think it could also develop Pillow if it were prompted. So there's that. I think we won't use any AI generated. In fact, we had an AI submission about something that was totally wrong. Like they were like, you should just change this code. And no, I wasn't. It was wrong in an embarrassing sort of way. And then there's the AGI, which I think I'm skeptical about that it ever would exist in our lifetime. But if it did, then maybe it's writing future releases and understanding what it's doing in terms of reacting to world events. Like when XE happened, we thought about not releasing the next release until we were sure about this or that. And so that's a huge thing. So maybe AGI could do that.
Yeah, I think the reason that I thought about that was that you see how that you... I mean, there's all these image generators now. You go to Bing, you go to ChatGPT or whatever, and they generate really cool images. And I'm like, you can do some of that scripting with Pillow and Python. And I'm like, well, how is that going to affect Pillow? I hope it doesn't affect it very much at all. But... I just thought I'd throw out the question since you're the pillow guy.
I think that people have asked for AI-like machine learning features, and we always say that's not in this library. So I wouldn't be surprised if it's used by the AI to render. That seems like something very likely. If you said, draw me some psychedelic art and then you compared it with the 2012 psychedelic art, you know, that was done by a human. In fact, I could even, I could probably say, here's this, can you make me more of these? And it would, and how it's doing that image processing is almost, you know, who cares? It's the, it's a platform to burn, you know, an implementation detail and pillow just happens to be how you do it in, in,
It's actually quite frightening in terms of the neural networks. First of all, I'll say about it, like every time machine learning versus deep learning comes, I have to look it up and remember, you know, cause I can never just remember which one's which. And the neural network that, you know, neural networks being part of that technical stack is terrifying in that, you know, so much is happening there that, that the, creators of the neural network don't know you know what the what the outcome will
I think it does. Yeah, I know. I know several people who post about it fairly regularly. And I probably should go to that website. There's a bunch of free material on Amazon and Microsoft's website. But I don't know. I just don't have time. I think so. Yeah. All right. So let's, uh, move on to the next question. Uh, are there any non-technical hobbies that you enjoy? Yeah.
So I'm a musician, uh, head straight band.com is, is where you can find out about my alternative rock. And I'm on Spotify with, with zero month monthly subscribers. So you can check that out. And iTunes, um, He it's been hard to, I like multi instrumentation. Like I like to play the, you know, the drums and the guitar and do vocals and stuff. And it's been hard lately with the state of the world. And, you know, I'm actually looking for Python, Django, Wagtail, React, AWS, you know, projects to work on. Um, I recently left NIH after like 10 years. So. It's hard to find time for those things, but as soon as I read that, I knew what my non-technical hobby answer was going to be. I still feel really strongly about it. I still pick up the guitar. It's kind of like Python programming, just that visceral feeling of playing the instrument.
There's some good, there's a EP three song and there's an album and the EP is my favorite. The album I think was, has some decent material on it, but had a lot of on almost like open source drama, you know, it looks like I had a lot of, didn't go that, you know, exactly the way I wanted it to. So there's always that.
Yeah. I'll get the, I'll get the links from you after the, after we get done with the show so I can show them in the show notes. So everyone else can check it out. All right. Well, I think that wraps up everything I was going to ask you today. So thank you so much for being on the show today, Alex.
