Python: Use image_slicer module to generate WeChat Jiugongge pictures with one click

Hello, everyone, my name is wangzirui32, today we will use Python's image_slicer module to write a program to generate nine-square grid pictures.

1. Install image_slicer

Open the cmd window and enter:

pip install image_slicer

The installation is successful without an error.

2. Write the program

from image_slicer import slicer

# 设置你要把图片分成几块 这里为9块
number = 9
# 要分割的图片的路径
picture = r"C:\Python\Python九宫格照片\test.png"

slice(picture, number)

Tips: The cut pictures will be placed in the original picture folder, but be careful!
After the split, there will be 9 new pictures in the original picture catalog. These pictures will be marked with several rows and several columns. Mom no longer has to worry about me getting confused!


Well, today's course is over. Although it is a little bit short, I hope you can learn the essence, bye!

Guess you like

Origin blog.csdn.net/wangzirui32/article/details/114216764