Python: Check the resolution of images in a directory

Check the resolution of images in a directory and output the filename of the incorrect images.

I had to check over 200 images and there was no better way than using Ruby or Python on OSX to go through all those image files and check their proper dimensions, and I chose Python for the job. In this particular scenario, I am loading all the files ending with extension .jpg and check if the dimensions of the image are 410 wide and 300 height. If the dimensions of the image are wrong I am outputting the filename of the image file, so I know which ones are wrong to fix them.

In order to run the script save it to a .py file in the directory where you want to check the image files, open the terminal and navigate to the location of the .py file and then run python script.py