The Python Papers

The Python Papers

Share this post

The Python Papers
The Python Papers
Adding Borders to Your Photos with Python and Pillow
Copy link
Facebook
Email
Notes
More

Adding Borders to Your Photos with Python and Pillow

Mike Driscoll's avatar
Mike Driscoll
Apr 08, 2025
∙ Paid
5

Share this post

The Python Papers
The Python Papers
Adding Borders to Your Photos with Python and Pillow
Copy link
Facebook
Email
Notes
More
Share

One way to make your photos look more professional is to add borders to them. Pillow makes this pretty easy to do via their ImageOps module. But before you can do any borders, you need an image. Here is the one you’ll be using:

Now that you have a nice image to play around with, go ahead and create a file named border.py and put this code into it:

Keep reading with a 7-day free trial

Subscribe to The Python Papers to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Mike Driscoll
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Copy link
Facebook
Email
Notes
More