import pywikibot

from pywikibot import pagegenerators

from IPython.display import Image

from IPython.core.display import HTML


site = pywikibot.Site('commons', 'commons')

cat = pywikibot.Category(site, 'Category:Barnacle_Goose')

gen = pagegenerators.CategorizedPageGenerator(cat)


for page in gen:

    url = page.get_file_url()

    if url.lower().endswith(".jpg"):

        display(Image(url,width=100, height=100))
print("done")