图像分辨率的调整
from PIL import Image
import os
import shutil
import xml.etree.ElementTree as ET
input_images_folder = "要调整的输入文件夹"
output_images_folder = "调整后的输出文件夹"
if not os.path.exists(output_images_folder):
os.makedirs(output_images_folder)
for filename in os.listdir(input_images_folder):
input_image_path = os.path.join(input_images_folder, filename)
if os.path.isfile(input_image_path) and filename.lower().endswith(('.jpg', '.jpeg', '.png')):
image = Image.open(input_image_path)
resized_image = image.resize((480, 320))
output_image_path = os.path.join(output_images_folder, filename)
resized_image.save(output_image_path)
print(f"已处理: {filename}")
print("图片分辨率和标签文件调整完成!")