I've some folders with about 200 images and I'd like to highlight the images with a size not multiple of 2.
Is there an efficient way of doing so?
Best Regards!
Here is a Python script that print all images that have a size which is not a multiple of 2. It simply finds all images and use PIL to get the dimension.
import glob
from PIL import Image
# Get all images
image_path = 'PATH TO YOUR IMAGES'
images = glob.glob(image_path + '/**.png') # Depending on your images extension
images_not_pair = []
# For all images open them with PIL and get the image size
for image in images:
with Image.open(image) as im:
width, height = im.size
if width % 2 is not 0 or height % 2 is not 0:
images_not_pair.append(image)
print(images_not_pair)