Contact us
Leave a message

Bitte benutzen:

Mein öffentlicher Kryptographie-Schlüssel

Mitglied bei



- Changed -u option to actually convert images to sRGB; -U
  can be used to set a path to an sRGB ICC file.
- UTF-8 handling seems to finally work.


- Added -u option to remove color profiles.
- Modified internal album template to use %t (%d) as the
  generated HTML pages' title.


- And yet another attempt!


- Yet another attempt to improve character encoding handling... sigh!


- Added flv and ogg as video file extensions
- Updated ffmpeg command-line arguments for extracting 1st frame
  from video files to latest ffmpeg calling conventions


- Fix: Errors when evaluating <str> tags enclosing text containing unescaped
  '$' and '@' characters
- Feature: Option to create Windows AUTORUN.INF file in target directory


- Initial adaption to new database schema version (4) introduced with digikam 0.10


The KDE photo management application digiKam is a really great piece of software (in spite of the fact that bug no 91562 still hasn't been fixed yet ;-). However, I was not completely satisfied with digiKam's HTML gallery export plugin due to several reasons:

  • The exporter does not provide a way to enforce a specific image ordering. So even if you managed to get your images sorted to your liking by, e.g. appropriately renaming the image files, in the exported gallery the images would still be sorted by the images' internal database ids.
  • Galleries seem incapable of representing the exported albums' hierarchical relationships (in terms of subdirectory structure)
  • To me, many of the provided themes seem inadequate for viewing at small screen resolutions. For instance, most of them waste a lot of vertical space for displaying the album name and navigation elements above the image, while the image's caption is displayed below. Hence reading the caption requires scrolling downward whenever the image exceeds a certain height.
  • Related to the last issue is the observation that it seems impossible to define maximum values for image width and height separately. So if you want landscape oriented images to be streched to full screen width, you automatically get portrait oriented images extending beyond the lower screen border.
  • Even after, say, only correcting a typo in an image caption, the whole gallery has to be re-created, which for large galleries takes quite some time.

Dunno, maybe some or all of these issues could be resolved by appropriately defined exporter themes. But since my Perl is way better than my XSLT, I just set out to write a little script that would allow me to create web galleries just the way I wanted them to be. The resulting script features quite a number of options, as can be seen from the following output: - Create HTML galleries from digkam albums
Version 1.0.6
Usage: [options] <album_pattern> [<album_pattern>...]
with possible options:
-?|--help                   : Print this message and exit.
-a|--album-template <path>  : Use <path> as HTML template for albums.
-A|--print-album-template   : Prints out the internal album template
                              and exits.
-b|--debug                  : Prints out all SQL queries issued
                              during gallery creation.
-B|--db-version             : digiKam database schema version; must
                              be either 3 or 4. [4]
-c|--include-collection <patt>:  Only include albums  belonging to a
                              collection matching the given SQL
                              pattern. May be specified multiple times.
-C|--exclude-collection <patt>:  Exclude all albums belonging to any
                              collection matching the given SQL
                              pattern. May be specified multiple times.
-d|--digikam-root <dir>     : Path to digiKam root directory.
                              [/home/tcrass/My Photos]
-D|--digikam-db <path>      : Path to digikam.db; assumed to reside in
                              digikam root, if not specified otherwise.
-e|--image-extension <ext>  : Extension of image files to be included.
                              May be specified multiple times; if
                              specified, the default list of image
                              file extensions will be overwritten.
                              [jpg jpeg png tif tiff]
-E|--movie-extension <ext>  : Same as -e, but for movie files.
                              [avi flv mov mpeg mpg ogg wmv]
-f|--flatten-photos         : Put photos of all selected albums into
                              one root album.
-F|--flatten-albums         : Treat all albums as sub-albums of a
                              common root album, disregarding the
                              original album tree.
-g|--include-tag <patt>     : Only include photos being tagged with
                              a tag matching the given SQL pattern
                              (or any of its sub-tags). May be
                              specified multiple times.
-G|--exclude-tag <patt>     : Exclude all photos being tagged with
                              a tag matching the given SQL pattern
                              (or any of its sub-tags). May be
                              specified multiple times.
-h|--home-string <string>   : Use <string> as name for the root album,
                              unless it does have a name or a caption
                              on its own. [Start]
-i|--image-size <size>      : Desired photo size in ImageMagick format.
-I|--thumbnail-size <size>  : Desired size for thumbnails (in
                              ImageMagick format). [128x128]
-k|--skip-empty-albums      : Do not include albums which do not
                              contain any photos.
-m|--include-movies         : Include movies into gallery, each being
                              represented by a static image of its
                              first frame. Requires ffmpeg.
-M|--include-movie-origs    : Include links to original movie files.
                              Implies -m
-n|--dont-recreate          : Don't recreate image files, but just
                              the gallery's directory structure and
                              HTML files.
-N|--only-new-photos        : Only process images which are not already
                              present in the gallery. Useful for adding
                              new photos to an existing gallery.
-o|--include-origs          : Include links to the original photo
                              files. Does not include movies; use -M,
                              if desired.
-O|--crop-thumbnails <size> : After resizing, crop thumbnails to <size>
                              (given in ImageMagick format). Specify
                              like -c '' to prevent cropping.
-p|--photo-template <path>  : Use <path> as HTML template for photos.
-P|--print-photo-template   : Prints out the internal photo template
                              and exits.
-q|--quality <q>            : Compression quality for photos. [90]
-Q|--thumbnail-quality <q>  : Compression quality for thumbnails. [80]
-r|--recurse                : Recursively add the selected albums'
-R|--min-rating <rating>    : Only include photos with a minimum rating
                              of <rating>. [0]
-s|--sort-photos-by <field> : Sort photos in albums by database column
                              <field>. [name]
-S|--sort-albums-by <field> : Sort each album's sub-albums by database
                              column <field>. [name]
-t|--target-dir <dir>       : Gallery output directory. WARNING: Will
                              get completely purged, unless -n or -N is
                              specified! [/home/tcrass/gallery]
-T|--date-format <format>   : Format used for displaying album creation
                              dates. [%F]
-u|--use-srgb-profile       : Convert images to sRGB color space (if
                              not in sRGB already). Recommended for
                              images presented in The Web.
-U|--srgb-profile-path      : Where to find the sRGB ICC profile file.
-v|--verbose                : Talk a lot.
-V|--version                : Print version number and exit.
-w|--win-autorun <label>    : Create Windows-style AUTORUN.INF style
                              in target directory. Effect: use <label>
                              as drive description and open gallery
                              start page in browser.
-x|--exclude-photos <patt>  : Explicitly exclude the specified photo(s)
                              from the gallery. May be used multiple
-X|--exclude-albums <patt>  : Explicitly exclude the specified album(s)
                              from the gallery. May be used multiple
                              times. Useful in conjunction with -r.
-y|--stylesheet <path>      : Use <path> as css stylesheet for album
                              and photo pages.
-Y|--print-stylesheet       : Prints out the internal stylesheet and
An internal default will be used for album template, photo template
and/or stylesheet, if their corresponding options (-a, -p and -y,
respectively) are not given.
Albums pattern always refer to full albums URL; however, SQL wildcards
may be used. Hence '%foo' selects both albums '/foo' and '/bar/foo',
while '%foo%' additionally selects '/foo/bar' and '/bar/foo/blah'.
Album exclusion patterns (-X) work in the same way; photo exlusion
patterns, on the other hand, refer to the photos' file names only.
Please note that literal percent characters (%) and underscores (_)
need to be escaped using '\'.
This programm relies on the Perl library Furthermore,
digikam2web requires imagemagick and the sqlite3 command-line client
to be installed and in PATH. If you want to include video files into
your galleries, you'll also need ffmpeg.

Have a look at a sample gallery featuring images of some reptiles and amphibians which has been created by calling digikam2web as follows: -kr -d ~/img/digiKam/ -g 'Reptiles%' -t ~/tmp/reptiles '%'

(In words: Recursively (-r) create a gallery in (-t) ~/tmp/reptiles containing all images tagged (-g) 'Reptiles%' from any ('%') album in the digikam root directory (-d) ~/img/digikam and remove those albums which have no images left (-k) after tag filtering.)


The zip archive contains the executable as well as the required Perl library