Forum Discussion
NatalieScott
May 15, 2025Iron Contributor
What is the best duplicate image finder for Windows 11?
The free space on my Windows 11 laptop becomes much less and only 5GB is available. As far as I know, there are many duplicate files especially the photos imported from my Android phone. I guess it i...
WilliamJackson
May 15, 2025Iron Contributor
Powershell has a built-in feature for finding duplicate images on any Windows 11/10/8/7 computer. You can run the following script to remove the duplicate files with installing duplicate image finder software:
import cv2
import numpy as np
from skimage.metrics import structural_similarity as ssim
def compare_images(img1_path, img2_path):
img1 = cv2.imread(img1_path)
img2 = cv2.imread(img2_path)
if img1.shape != img2.shape:
print("Different dimensions!")
return False
# Convert to grayscale for SSIM
gray1 = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)
gray2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
# Compute SSIM
ssim_score = ssim(gray1, gray2)
print(f"SSIM Score: {ssim_score}") # Closer to 1 means more similar
# Compute MSE
mse = np.mean((img1 - img2) ** 2)
print(f"MSE: {mse}") # Lower means more similar
# Thresholds (adjust based on needs)
if ssim_score > 0.95 and mse < 10:
return True # Likely duplicates
else:
return False
is_duplicate = compare_images("image1.jpg", "image2.jpg")
print("Are duplicates:", is_duplicate)