Skip to content
A set of small utilities and a script to process the files exported from Dwarf Fortress's Legends Mode
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitattributes
.gitignore
7z.dll
7z.exe
7zip_license.txt
LICENSE.txt
Legends Exports Processor.bat
README.md
legends_processor.py
optipng license.txt
optipng.exe

README.md

THIS PROJECT IS OBSOLETE

I have moved my maintenance efforts entirely to the legends processor module of the PyLNP, which is more stable and efficient. While this bundle will remain available, I suggest using the PyLNP instead unless you have good reason not to.

https://bitbucket.org/Pidgeot/python-lnp

LegendsExportsProcessor

A simple script to compress and sort the files exported from Dwarf Fortress' Legends Mode.
Compressing the .bmp maps to .png usually reduces file size by 95 to 99+ percent (yes, really).
Compressing the legends.xml, which is tens to hundreds of MB, often reduces the file size by a similar margin.
The script then moves the compressed files to region-specific folder and puts site maps and world maps in separate subfolders.

To get a copy, can use the 'download as a zip' option on the right and place the whole unzipped folder in the LNP/utilities folder of the DF Starter pack or the contents in the same folder as the Dwarf Fortress executable.

This script is released under the GPL3. License files for 7zip and OptiPNG are included.


General overview of functions:

  1. Find the folder to work in (must contain "Dwarf Fortress.exe"), either in current folder or the relative path from a Starter Pack utilities folder

  2. Establish which region's exports we're working with, by iterating back from 99 and looking from a match. Display message explaining function of the script if nothing is found.

  3. Call OptiPNG to compress the bitmaps to PNG format.

  4. Call 7zip to compress the legends XML in .zip format. If all required files are available, an archive compatible with "Legends Viewer" will be created (includes other text history files and a map).

  5. Move all output files to a "User Generated Content" folder next to the Dwarf Fortress folder, and delete color key text files.


The Python version is written for Python 3 as a cross-platform implementation.

It is more robust regarding unexpected circumstances, and uses the built-in zipfile function instead of 7z.
However, it isn't quite cross-platform as I'm unsure how to comvert bitmaps without optipng available.
It must be run in the DF folder, and won't work from anywhere else - unlike the .bat version.

You can’t perform that action at this time.