lrprev-extract-go
is a Go-based command-line tool designed for extracting the largest JPEG images embedded within Adobe Lightroom's .lrprev
files. In addition to extracting images, the tool can also utilize Lightroom's catalog database (.lrcat
) to ensure that the JPG files are stored in a structured way according to their original paths. π
This project aims to facilitate the management of your Lightroom previews and is especially useful for photographers looking to backup or organize their image assets efficiently. With simple command-line options, users can quickly extract images from directories of Lightroom previews or individual files.
.lrcat
) if you want to structure your output by original paths.Clone the repository:
git clone https://github.com/harperreed/lrprev-extract-go.git
cd lrprev-extract-go
Compile the code:
go build -o lrprev-extract ./cmd/lrprev-extract
Install required dependencies on Linux:
sudo apt-get install -y libgl1-mesa-dev xorg-dev
The main executable is lrprev-extract
. You can invoke it from the command line with the following options:
./lrprev-extract [-d <path-to-lightroom-directory> | -f <path-to-lrprev-file>] [-o <output-directory>] [-l <path-to-lrcat>] [-include-size] [-help]
-d
: Specify the path to a directory containing .lrdata
files.-f
: Specify the path to an individual .lrprev
file.-o
: Specify the output directory where the extracted JPEGs should be saved.-l
: Specify the path to your Lightroom catalog (.lrcat) [Optional].-include-size
: Include the size of the images in the filename of the output JPEGs [Optional].-help
: Display help information and usage examples.If you don't provide the required arguments, the tool will prompt you for the necessary information interactively.
To extract images from a directory:
./lrprev-extract -d /path/to/lightroom -o /path/to/output
To extract images from a single .lrprev
file:
./lrprev-extract -f /path/to/file.lrprev -o /path/to/output
To extract images and include size information in the filename:
./lrprev-extract -d /path/to/lightroom -o /path/to/output -include-size
To extract images and use the Lightroom catalog for original file paths:
./lrprev-extract -d /path/to/lightroom -o /path/to/output -l /path/to/catalog.lrcat
To use the interactive mode:
./lrprev-extract
This will prompt you for the necessary information step by step.
To display help information:
./lrprev-extract -help
github.com/mattn/go-sqlite3
: A pure Go SQLite driver.github.com/schollz/progressbar/v3
: A progress bar for console applications.github.com/rivo/tview
: A rich TUI library for Go.lrprev-extract-go/
βββ README.md # Documentation file
βββ cmd # Command line interface code
β βββ lrprev-extract # Main executable for the tool
β βββ main.go # Entry point of the application
βββ go.mod # Go module file for dependencies
βββ internal # Internal logic for the application
β βββ cli # CLI interaction logic
β β βββ cli.go
β βββ database # Database interaction logic
β β βββ database.go
β βββ extractor # Extraction logic for JPEGs
β β βββ extractor.go
β βββ utils # Utility functions
β βββ utils.go
main.go
: The main application entry point that handles command-line arguments, interactive prompts, and invokes the appropriate functions for file processing.cli.go
: Contains functions for interactive prompts and input validation.database.go
: Contains functions for interacting with the Lightroom catalog database to retrieve original file paths.extractor.go
: Implements the logic to read .lrprev
files, extract JPEGs, and manage the output with detailed progress reporting.utils.go
: Contains utility functions, including the extraction of UUIDs from filenames.utils_test.go
: Contains unit tests for the utility functions in utils.go
.The TUI (Text User Interface) has been enhanced with the following features:
The project includes unit tests for the utility functions. To run the tests, use the following command:
go test ./internal/utils
Feel free to contribute! We welcome any improvements or bug fixes. π
For issues and feature requests, please create an issue on the GitHub Issues Page or submit a pull request! Happy coding! π»π₯