Recently, many P-picture software has achieved an effect: dividing a picture into 9 pictures
Code description
This function is implemented by a third-party library: poimage. The download command is as follows:
pip install poimage
After downloading, cutting the image only requires the following line of code:
Use Python to post an elegant circle of friends with just one line of code
import poimage
poimage.split4img(img_path=r"./imgs/icon2.jpg", output_path=r'D:\grant的文件夹\output')
Parameter Description:
-
img_path: the image that needs to be cut, the storage path;
-
output_path: where the cut image is stored.