Welcome folks today in this blog post we will be adding the colorful border frames
to image files using pillow
library in python. All the full source code of the application is shown below.
Get Started
In order to get started you need to install the below library using the pip
command as shown below
pip install pillow
And after that you need to make an app.py
file and copy paste the following code
app.py
1 2 |
from PIL import Image,ImageOps ImageOps.expand(Image.open('input.png'),border=40,fill="#f00").save("bordered.png") |
As you can see in the above python code we are importing the pillow
library and then we are adding the colorful
border to the image. Here we are providing the hexadecimal
color value of red
color and we are providing the numeric
value for the border which is 40 and then using the save()
method to save the output image