This Python program builds static 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 photo 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 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. 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, and images can be previewed with a basic GUI-mode viewer.
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 can be customized in settings; 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. There's an update on Pillow installs here.
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 12 tested among Mac OS, Windows and Linux, and the 10 tested across Android and iOS.
Recent releases have added:
thumbspage comes with complete usage examples, in-program documentation, and a comprehensive HTML user guide with information for both end users and developers. 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.
thumbspage is provided as open-source and portable source code that you run with a Python installed separately (usually 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 110M today)
is taken up by its top-level
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.
This program was last changed: March 6, 2020.
For more code examples, see the Programs page on this website.