This is the home of CGG, Cataract Gallery Generator - a simple static web photo gallery, designed to be clean and easily usable. Due to its static design, there's no way to comment pictures on the web.

Feature highlights:

  • static HTML gallery, no extra requirements on server
  • fast, easy to cache/mirror
  • XML-based description files
  • modern design, valid XHTML 1.0 and CSS 2
  • EXIF & IPTC support
  • Atom feed writer
  • multithreaded console application allowing easy scripting (e.g. auto-refresh after new images are uploaded via FTP)
  • licensed under GNU GPLv2 license

Planned features:

  • GraphicsMagick port
  • optional pushing comments and captions to images
  • switchable flat album view
  • slideshow mode
  • mobile/lite version
  • switchable styles
  • jBrout db support?
  • stars rating system (iframed php script?)


CGG creates a set of HTML files and images from the source structure. Input files are structured in subdirectories, each directory may contain only one index XML file and the generated directory tree copies the source structure. All links to sub-galleries, items, descriptions and individual settings are specified in XML files. No more files other than global setup XML file are needed.

For convenience, sources contain the cgg-dirgen script, which creates an index XML template from images in current directory. That can be used as a skeleton of new album, writing down title, description and comments.

For detailed syntax of input XML files please check the sample gallery included in the source tree. It demonstrates basic features and contains detailed tag description inside the XML files.

Please also see the CSS Issues page for information about current design problems.


  • As a general rule, all nested tags have to be surrounded by the CDATA block, e.g. <![CDATA[<b>text</b>]]>
  • It's strongly discouraged to use named entities like &lt; or &gt; outside the CDATA block as the XML parser will unescape them to < and > automatically which might lead to validation troubles. Some other commonly-used HTML entities like &copy; are unknown to the XML parser and will throw an error.
  • Lonely ampersands (forgotten or inside a URL) get escaped automatically for the safety. Opening ampersands in the entities are left untouched.

Update mode, timestamps

Since 0.99.3, there's an update mode available. It will check the output structure for missing files and re-generate them as necessary. The decision whether an item (file, picture, album) needs to be updated is done by comparing timestamps (mtime specifically). Due to that reason it's important to keep this fact in mind when replacing single image which carries older timestamp than other files. Either don't use the update mode or 'touch' that new file. Changes made to any XML file will result in whole album re-generation (excluding subalbums).


For easy validation of single files you can use well-known W3C Markup Validator. For automated validation of series of files it's better to use command-line tools like xmllint, which is a part of the libxml2 suite, also heavily used in cataract.

Using xmllint we can easily validate all html files in the current directory structure:

for i in `find -regex '.*html$'`; do (echo "=================== $i"; xmllint --valid --noout $i); done

This will automatically download linked DTD schema (XHTML 1.0 Strict in this case) as defined in the XML header. Processing large number of files might be inconvenient and you may want to use locally cached schemes. Running

XML_DEBUG_CATALOG="1" xmllint --valid --noout <file.html>

will tell you which schema files are needed. Then just create local catalog file, as described on the Wikipedia XML Catalog page:

<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
    <public publicId="-//W3C//DTD XHTML 1.0 Strict//EN" uri="xhtml1-strict.dtd"/>

and pass it as XML_CATALOG_FILES variable:

XML_CATALOG_FILES="catalog.xml" xmllint --valid --noout <file.html>


Source code: cataract-1.1.0.tar.bz2 (4,639 kB)

For older releases see http://cgg.bzatek.net/files/


gitweb: http://git.bzatek.net/?p=cataract;a=summary

repository snapshot command:

git clone git://git.bzatek.net/cataract

For write access to the repository please contact developers. Feel free to send any patches, we'll review them and commit if suitable.


Cataract - Static web photo gallery generator
Copyright (C) 2008-2010 Tomáš Bžatek <tbzatek@users.sourceforge.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


My personal photo gallery has been generated with CGG, check it here: http://foto.bzatek.net

Latest News


5 December 2010

  • Fix badly reported day of the week in EXIF date string
  • Added Atom feed generator
  • Added support for squared thumbnails

24 October 2009

  • multithreading fixes
  • memory leak fixes
  • thumbnail orientation is now independent of source image orientation

9 May 2009

This is a release candidate version.

  • timestamp-based update mode
  • multithreading
  • support for interspaces
  • support for custom index file name
  • user customizable image directories and thumbnail names
  • more flexible block parser

28 March 2009

  • improved HTML entity handling
  • support for extra (enclosed) files in the album
  • favicon support
  • support global and album-level <nofullsize> tag
  • better flexibility in source paths
  • safer template parser (placeholders)
  • ported to autotools
  • theming and template improvements

11 January 2009

  • ported to exiv2 library, fixed wrong shutter times
  • added support for various image borders
  • added support for supplied thumbnails
  • added support for footnotes
  • meta tags support
  • support for album index separators
  • successive image preload
  • thumbnail names are now unique
  • titles and descriptions variability (inheritance, EXIF/IPTC extraction)
  • embedded thumbnail stripping
  • support for hidden albums
  • better XHTML 1.0 Strict conformance
First public release

27 July 2008

First public release (v0.99.0). Small syntax changes to input XML files planned soon.