import os from PIL import Image root_folder_path = '文件夹路径' for item in os.listdir(root_folder_path): item_path = os.path.join(root_folder_path, item) if item_path.lower().endswith('.tif'): try: image = Image.open(item_path) width, height = image.size print(f"文件路径: {item_path}, 宽度: {width}, 高度: {height}") except Exception as e: print(f"处理文件 {item_path} 时发生错误: {e}")
批量打印文件夹内所有tif影像的行列数
最新推荐文章于 2024-06-17 17:35:06 发布