2. PIL library¶
2.1. Introduction to the PIL library¶
PIL (Python Image Library) is a powerful image processing library for python. Using this library, we can do a lot of processing work on images. We can install the Python-PIL library on the Lubancat board and write some test codes through jupyter to use the library.
2.2. PIL library installation¶
We use the apt tool to install.
# Enter the following command in the terminal to install the PIL library:
sudo apt -y install python3-pil
Just wait for the installation to complete.
2.3. PIL library usage¶
After installing the corresponding library, we can use the jupyter installed earlier to write the test code.
The test code is as follows:
The effect is as follows:
Original image:
After code execution:
You can upload the supporting code directory “libdemo\PIL\PIL.ipynb” file to jupyter for use.
More about the usage of the Python image processing library, you need to explore by yourself. It should be noted that after the Python3 version, the image processing library is pillow, which is a compatible version based on PIL.