digiKam

Professional Photo Management with the Power of Open Source

New renaming tool for digiKam

by Andi Clemens

advancedRenameWdget

In the past renaming images in digiKam was not very powerful. Most users (me too) renamed their images with KRename, a quite powerful batch renamer. But calling KRename from the "Open With..." dialog in digiKam was not very intuitive, it just felt wrong.

digiKam can manage nearly every piece of information found in an image, therefore it would be nice to have all this information available for file renaming, too, since renaming is one of the basic managing tasks.
Sure there is a KIPI plugin for batch renaming, but this plugin is not very powerful and has no access to the digiKam database.

So I started to implement a new utility for digiKam: AdvancedRename. The goal of this tool is quite simple:
Allow the user to enter EVERY possible information digiKam might have about an image and let the user decide in which order these information are added to the file name.

The easiest way to do this is to have a line edit widget, that accepts special characters and replaces them with the parsed information for every image, in a same way KRename does it.
The problem:
Although very powerful, it can become quite annoying entering all those token characters by hand. A token should be added with a single click, the line edit then receives its focus back and the user can continue to type in other information.
Tokens that can take parameters should have a config dialog, so that in the best case the user doesn't have to remember any parameters at all.

Another important goal was to be able to modify each parsed information afterwards, for example to remove unwanted strings from file or directory names. But unlike in KRename, these modifiers should be chainable and be applied to any token, not only the file name.
So after fiddling around for many weeks, the first version of AdvancedRename is ready to use.

Its features so far:

  • Add information about file, directory and camera names
  • Add date time information
  • Add sequence numbers
  • Add metadata keys (Exif, IPTC and XMP are supported and can be selected with a searchable dialog)
  • Modify any parse result with chainable modifiers (lowercase, uppercase, first letter of each word uppercase, trimmed, simplified, range, replace...)
  • Easily add the tokens with quick access buttons, either through a buttonbox or a toolbutton menu (depending on the style settings)
  • Syntax Highlighting of options in renaming string

tooltip.png

It is by far not perfect (what is perfect anyway ;-)), but most of the renaming goals should be convertible already.

TODO:

  • when a token or modifier is selected, enable an edit button to change the token with a GUI
  • add more parsers (image statistics, some more digiKam related information etc...)

Update: New UniqueModifier


I implemented a new modifier that should guarantee unique strings in a renaming option. It will append a suffix number if a string has already been assigned. This can be useful for example when used in combination with a [date] option. See the following example screenshot:
UniqueModifier in digiKam

An example


replace.png trimmed.png Syntax Highlighting in digiKam rename tool

These screenshots show how modifiers can be chained. First we replace the word "Amazing" from the filename with "Boring" (notice the extra whitespace we added in this example). Then we apply a TrimmedModifier to remove leading, trailing and extra whitespace again. Finally an UppercaseModifier is applied.
Every token can be chained with modifiers. If you use modifier strings somewhere else in the renaming string, they will be displayed as normal text.