其中1文件夹中有重复出现的图片,只是图片名不同。
2文件夹为空文件夹,用于保存去除的重复图。运行py文件。
import shutil
import numpy as np
from PIL import Image
import os
def 比较图片大小(dir_image1, dir_image2):
with open(dir_image1, "rb") as f1:
size1 = len(f1.read())
with open(dir_image2, "rb") as f2:
size2 = len(f2.read())
if(size1 == size2):
result = "大小相同"
else:
result = "大小不同"
return result
def 比较图片尺寸(dir_image1, dir_image2):
image1 = Image.open(dir_image1)
image2 = Image.open(dir_im