Count number of images (image files) in a directory using Python

I am working on a python program, where i do need to process the images which are stored in a directory along with other files.

But from my program i need to fetch only specific files, something like filter in open dialog box.

How to do this in python ?