如何使用Python将长图片分隔为若干张小图片
1. Python需求的任务
_
使用Python将长图片分隔为若干张小图片
我有如下的一张长图片
想要将其分割为若干张小图片
2. Python代码的实现
from PIL import Image
def cut_image(image_path, output_folder, width, height):
image = Image.open(image_path)
image_width, image_height = image.size
# 计算需要切割成多少行和列的小图片
rows = image_height // height
columns = image_width // width
count = 0
for row