PyGallery is a program used to generate static html-based picture galleries
for the web. A gallery consists of an index page containing thumbnail images
of the pictures. Clicking on a thumbnail jumps to that image.
Gallery is distributed as Python source code (GPL), at
To run it, you will need:
The basic Python installation: http://www.python.org/download
The Python Imaging Library: http://www.pythonware.com/products/pil/
To run gallery, double-click on the PyGallery.py file or type:
On Mac OS X type pythonw instead of python.
To run gallery in console mode (without the GUI), just cd to a
directory with some images and run:
python bla/bla/PyGallery.py --Gui=0
A directory gallery-out will be created in the parent dir.
The general command line is
python PyGallery.py [OPTIONS] [InputDir] [OutputDir]
You have the option of controlling the output by the graphical user
interface, by command line options of the form --Key=value, or by
creating a text file named 'gallery.cfg' containing lines of the
The possible keys are:
Style = The style of the thumbnail page. Choose:
single thumbnail displays a preview of the image
the mouse is over (default).
ThumbFrame - The index is placed in a frame on the left and all
the thumbnails are displayed in a column.
Gallery - A normal thumbnail page.
Exhibit = Turn on to display the pictures in a html page with navigation
buttons and off to display simply the picture. Default: 0
InputDir = Directory of the pictures you want to make a gallery of.
Defaults to the current directory, or in the case that.
OutputDir = Directory in which to store generated html.
Defaults to the current directory.
Gui = Show or don't show the Graphical User Interface for these options.
Nearly all options can be configured in the GUI. Default: 1
ThumbRelDir = Directory (relative to OutputDir) in which to store
thumbnails. Default: g_thumbs/
PictureRelDir = Directory (relative to OutputDir) in which to copy
the original pictures if the option
CopyOriginalPictures is on. Default: g_pictures/
LowResPictureRelDir = Directory (relative to OutputDir) in which to
store the lower resolution pictures, if the
option GenerateLowResPictures is on.
Title = Gallery title, defaults to "Gallery " + directory name.
In recursive mode, this configuration property is reset to
the default for each directory (no inheritance to subdirs)
Captions = Gallery captions, in the form "author caption" where
the (optional) author is separated by a tab from the caption.
White space around the author or caption term is removed.
Caption is pasted verbatim in the HTML code. Defaults to nothing.
CreateLowResPictureIndex = Generates a picture of smaller size, e.g.
optimized for viewing without scrolling on a
1024x768 screen. Default: 1
CreateNormalPictureIndex = Whether or not to generate an index with
the normal picture size. Disable this if you
need only the low resolution gallery. Default: 1
DefaultIndex = Which index is displyed as default (as index.html). The
other indices (and the corresponding pictures and exhibits)
will get a suffix (for example "_small" for low resolution or
"_big" for full resolution). If you use different default
indices in a multidirectory gallery you will get some broken
links. It can be either "Normal" or "LowRes".
Default is "LowRes"
CopyOriginalPictures = Whether to link to and display the pictures in
InputDir or copy them to OutputDir/PictureRelDir
RebuildAll = By default, thumbnail and low resolution images are not
recalculated if already are available. Turn on this option if
you want to recalculate all from zero. Default: 0
ReUploadAll = By default, only new or changed files are uploaded to the FTP
server. Turn on this option if you want to upload whole gallery
from scratch. Default: 0
ExcudeList = A comma delimited list of directories or pictures you don't
want to include in the gallery. Accepts glob wildcards.
Defaults to nothing. Default: nothing
FtpTo = URL of the type [ftp://][username:password@]host[:port][/directory]
indicating where to automatically upload the gallery.
Defaults to nothing.
RecursiveProcessInputDir = Turn on this option if you have pictures in
some subdirs of InputDir and want to make
galleries of them. Default: 0
InheritThisConfigToSubDirs = Tells if the configuration overrides given
in a gallery.cfg file apply only to that
directory or also to all its subdirectories.
Applies only to gallery.cfg files, the
default, command line or GUI configurations
always apply to all directories.
MergeWithSubdirs = If on, the generated gallery contains also the pictures
of all subdirectories, if off only the pictures of
InputDir. Default: 0
PicsPerGallery = You can split large galleries into many galleries with
no more than this number of pics. Default is 40.
AutoAdjustPicsPerGallery = Turn on to let the script automatically adjust
PicsPerGallery by a few units if this enhances
the appearence of the gallery index. Default: 1
NumColumns = Number of thumbnail columns in the index page in the
Gallery style. Set to 0 or auto for automatic choice. Default: 0
ThumbMaxWidth = Upper limit to the width of the thumbnail (in pixels).
Defaults to 130.
ThumbMaxHeight = Upper limit to the height of the thumbnail (in pixels).
Defaults to 100.
WriteCaptions = Display the captions. This option controls the exhibit
captions, the gallery captions and the captions in the index
WritePictureName = Display the picture file name below the thumbnail.
WritePictureSize = Display the picture dimensions (in pixels x pixels)
below the thumbnail. Default: 0
WritePictureFileSize = Display the picture filesize in KB below the
thumbnail. Default: 1
ThumbTableBorder = Thickness of the border of the table with the
thumbnails (in pixels). Default: 0
ThumbTableCellPad = Minimal thickness of the cell pad of the table
with the thumbnails or the picture names (in
pixels). Default: 6
IndexBGColor = Background color of the index. Defaults to '#EEEEEE'.
NavigationArrowsPosition = Chooses where to display the navigation arrows
in the exhibit, i.e the buttons linking
to the next and to the previous picture.
1: above the picture, 2: below the picture,
3: both, 0: none. Default: 1
NavigationArrowsStyle = Chooses between different styles for the navigation
arrows. Look at the source code, the test gallery
or the html manual for more precise info. If equal
0, style 1 is used for framed pages and style 2
for non-framed pages. Default: 0
ExhibitBGColor = Background color of the exhibit. Defaults to '#EEEEEE'
CaptionColor = HTML color '#xxxxxx' code for picture captions. Defaults
to '#000000' (black)
IndexFileName = Complete file name of generated gallery index.
IndexBGImage = File name of background image to use for the thumbnail page.
You may want to have IndexBGColor similar to the color of
IndexBGImage, since the text color is choosen to be in high
contrast to IndexBGColor. Defaults to nothing, which means
that the uniform color IndexBGColor is used.
ExhibitBGImage = File name of background image to use for the individual
exhibit pages. Defaults to nothing
IndexLinkBack = Chunk of text placed above and below the table of
thumbnails on the index page. This is usually a html tag
linking back to a main page. Defaults to nothing
LeftArrowImage = Url or file name of graphic to use as left navigation
arrow. Default: leftArrow_TN.gif
RightArrowImage = Url or file name of graphic to use as right arrow.
ParentGalleryImage = Thumbnail that is used to indicate the parent
directory. Default: back_TN.jpg
OnlyGalleriesImage = Thumbnail that is used when galleries have no
pictures (only subgalleries). Default:
PythonLogoImage = Url or file name of graphic to use as python logo.
Defaults to nothing. If you want it: use
GalleryLogoImage = Url or file name of graphic to use as the Gallery logo.
Defaults to nothing. If you want it: use gallery_TN.gif
Finally, you can add captions to the exhibits by creating text
files in the same directory as the pictures, with the same file name
as the picture and the extension ".txt". The text file should
contain lines of the form:
where the (optional) author is separated by a tab from the caption.
To add multiple captions to a given picture, just add extra lines of this
format to the text file. PyGallery also parses the descript.ion files
of the picture viewing program AcdSee.
You can also add sound to your exhibits by adding a caption of the form:
<bgsounds src=xxxx.wav><embed src=xxxx.wav autostart=true hidden=true>
Where xxxx.wav is the sound file and is located in the same directory
as the exhibit page.
There is a test directory located in pyGallery/test with some pictures,
captions and configuration settings. To run it, change to that dir and
It will create the gallery in PyGallery/gallery-out
We hope you enjoy it.
You can send comments to us at: