Pictures and thumbnails

One of the benefits of using a jupyter notebook for blogging is that I can write a small program to show pictures. I think this is great to show a bunch of pictures in a folder. I can just glob the files and loop through them. Whatever appears in the output cell is then displayed in the blog.

I made an exptension for Sphinx to customize how it displays a list of images like the one below. The #montage tag in the code cell tells the sphinx extension to show a gallery of pictures. These pictures are shrunk during the blog build step to show a small thumbnail in the main text but they can be clicked to show the original.

Boat trip in Greenland

We went on a boat trip in Greenland and took pictures of the ice 😁 It was beautiful!

[8]:
1#montage
2
3from IPython.display import Image, display
4from glob import glob
5
6for img in glob("./greenland/*.JPG"):
7    display(Image(img))

I can also hide the code cell by adding a hide tag at the top of the cell to show the pictures without the code.