Manual export-import of styles, presets and masks

Page written after chat on IRC on 2014-11-02.

As of 2014, darktable stores styles, presets and masks in a sqlite3 database.

It is useful sometimes to delete the database to fix some problems.

But user may want to keep their styles, presets and/or masks through the database purge.

Default location of database is ~/.config/darktable/library.db but user can choose any other location with the --library command line argument.

Alternate solution: keep original database intact, use an alternate location to import, then replace main database only after confirming everything is okay in the alternate location.

Steps below are not official, use and adapt at your own risks.


  • Before operating, quit darktable, wait until the process has actually exited.
  • Backup your database before any operation, for example:
cp ~/.config/darktable/library.db  ~/.config/darktable/library.db_manualbackup_2014-11-03

Check if backup is okay

darktable --library ~/.config/darktable/library.db_manualbackup_2014-11-03

Check how it works, then quit, wait until the process has actually exited.

Exporting elements

sqlite3 ~/.config/darktable/library.db
.output presets.backup
.dump presets
.output styles.backup
.dump styles
.output style_items.backup
.dump style_items
.output masks.backup
.dump masks

Purging database

Dangerous! Make sure you still have your backup.

rm ~/.config/darktable/library.db

Run darktable once to recreate an empty database, then quit.

Importing elements

Don't reimport everything, only what you actually need. If the problem is in those settings, reimporting them will bring the problem back.

sqlite3 ~/.config/darktable/library.db <presets.backup

sqlite3 ~/.config/darktable/library.db <styles.backup
sqlite3 ~/.config/darktable/library.db <style_items.backup

sqlite3 ~/.config/darktable/library.db <masks.backup

Import only once or you'll end up with duplicates.

Rolling back

If something is wrong, you can put things back in order from your backup

cp  ~/.config/darktable/library.db_manualbackup_2014-11-03  ~/.config/darktable/library.db

Also available in: PDF HTML TXT

Go to top