#!/usr/bin/env python import Image import sys import fnmatch import os the_path = sys.argv[1] files = [] for root, dirnames, filenames in os.walk(the_path): for filename in fnmatch.filter(filenames, '*.png'): files.append(os.path.join(root, filename)) htmlPrefix = ''' ''' htmlSuffix = ''' ''' body = "" body+= "" for file in files: img = Image.open(file) path,filename = os.path.split(file) width,height = img.size body+= r'' body+= "
'+''+''+ filename + ", " + str(width)+ " x " +str(height) +r'
" f = open('index.html', 'w') f.write(htmlPrefix+body+htmlSuffix)