thumbspage — Turn Folders into HTML Image Galleries

This Python program builds web pages for user-friendly viewing of all the images in a folder. Its results do not require a web server, and can be viewed in any desktop or mobile browser, both offline and online. As such, thumbspage makes general image galleries, useful in a variety of contexts.

Click this page's images for quick live demos. Its contents:


thumbspage allows you to view or display a folder of photos and other images in a web browser, in a format that's both simple and noticeably better than browser defaults.

Given an image-files folder, thumbspage generates thumbnail images, a top-level HTML index page, and optional HTML image viewer pages with next/previous navigation links, slideshow and fullscreen toggles, and info popups. When clicked or tapped, thumbnails on the index page open either built viewer pages or browser-native image displays. The index page can also include bullet links to any nested subfolders in the images folder.

Run parameters—image folder path, thumbs per row, thumbs max size, and viewer-pages option—are input interactively in the console. For more control, custom HTML header and footer sections for the index page can be provided in the images folder; colors and more can be customized in the configs file; and the program's viewer-page template may be changed as desired.

The generated index page, along with a subfolder containing thumbnail images and generated viewer pages, are created in the images folder itself. Open the generated index page there ("index.html" by default) to view results, and package the complete images folder to publish (e.g., copy into your product, or zip and upload to your website).


This program uses and requires Python 3.X, plus the 3rd-party Pillow image-processing library. Any platform supported by both of these systems can run thumbspage, including Mac OS, Windows, Linux, and Android. For more on gallery-build platforms and installs, see the User Guide.

The pages this program creates work on all commonly used desktop and mobile browsers. Any recent version of Chrome, Firefox, Safari, Edge, and Internet Explorer should suffice—including the more than 12 tested among Mac OS, Windows, and Linux, and the 10+ tested across Android and iOS.

Recent releases have added:


thumbspage is used for all the galleries on this website (42 at last count), and comes with complete usage examples, in-program documentation, and a comprehensive HTML User Guide with information for both gallery viewers and builders. See the resources listed below for more details.

If you prefer to learn by example, study the demo sites here and here for a sparse but quick tutorial. For illustration, these sites use custom headers and settings, which you don't need to code if the defaults work for your galleries.

The Docs

The Code

Live Demos





thumbspage is provided as open-source and portable source code that you run with a Python installed separately (for example, in Terminal on Mac OS and Linux, Command Prompt on Windows, or a mobile-platform app). Use the following links to either fetch thumbspage and unzip it on your computer, or view its complete unzipped content online.

Note: most of the zipfile's size (about 157M today) is taken up by its top-level examples folder, which can be freely removed (albeit at the expense of breaking links in your local copy of the User Guide). To reclaim space, delete this folder after unzipping, view its online content here, and use the online copy of the User Guide here.

Fetch and Browse

This program was last changed: October 5, 2020.

Its latest update silences a harmless-but-confusing Pillow DOS warning (and prevents a rarer error) for large images. See all its version history here.

Related Programs

For more code examples, see the Programs page on this website.

[Home] Books Programs Blog Python Author Training Search Email ©M.Lutz