# -*- coding: utf-8 -*-
# time: 2024/6/21 10:13
# file: read_V3.0.py
# author: Wukong
import os
import pandas as pd
from PIL import Image
import exifread
def extract_image_info(image_path):
try:
# 使用PIL打开图片
img = Image.open(image_path)
# 获取图片的基本信息
width, height = img.size
format = img.format
mode = img.mode
# 使用exifread读取EXIF数据
with open(image_path, 'rb') as f:
tags = exifread.process_file(f)
exif_data = {str(tag): str(tags[tag]) for tag in tags.keys()
if tag not in ('JPEGThumbnail', 'TIFFThumbnail', 'Filename', 'EXIF MakerNote')}
# 创建一个字典,包含所有图像信息
image_info = {
'Path': image_path,
'Width': width,
'Height': height,
'Format': format,
'Mode': mo
批量读取图片-属性-详细信息-保存到Excel
于 2024-07-23 17:26:32 首次发布