A comprehensive JPEG2000 processing tool with BnF compatibility
Project description
JP2Forge
JP2Forge is a comprehensive Python tool for converting images to JPEG2000 format with support for standard and BnF (Bibliothèque nationale de France) compliant workflows.
Key capabilities:
- High-quality JPEG2000 conversion with multiple compression modes
- BnF-compliant processing for cultural heritage digitization
- Parallel processing for efficient batch operations
- Quality analysis and validation with PSNR/SSIM metrics
- Multi-page TIFF support with automatic page extraction
- Comprehensive metadata preservation and XMP integration
Quick Start
Installation
Option 1: From Source (Recommended for Development)
# Clone repository
git clone https://github.com/xy-liao/jp2forge.git
cd jp2forge
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies (includes jpylyzer)
pip install -r requirements.txt
# Install ExifTool (required for metadata operations)
# macOS:
brew install exiftool
# Linux:
# sudo apt-get install libimage-exiftool-perl
# Windows:
# Download from https://exiftool.org/ and follow installation instructions
Option 2: Via pip (When Available on PyPI)
pip install jp2forge
# Install ExifTool separately (see above)
Basic Usage
# Convert a single file
python -m cli.workflow input.tif output_dir/
# Process a directory with parallel processing
python -m cli.workflow input_dir/ output_dir/ --parallel --max-workers 4
# BnF-compliant conversion
python -m cli.workflow input_dir/ output_dir/ --bnf-compliant
Verifying Your Installation
To verify that everything is set up correctly:
# Make the test script executable
chmod +x test_jp2forge.sh
# Run the test script
./test_jp2forge.sh
This test script validates JP2Forge by processing images in three different scenarios and checking the outputs.
Key Features
- Multiple Compression Modes: Lossless, lossy, supervised, and BnF-compliant
- BnF Standards Support: Fixed ratios, standard parameters, XMP metadata in UUID box
- Advanced Parallel Processing: Adaptive worker pool with resource monitoring
- Memory-Efficient Processing: Handles large files via streaming and chunking
- Multi-page Document Support: Automatic handling of multi-page TIFF files
- Quality Analysis: PSNR, SSIM, and MSE measurements
Documentation
| Document | Description |
|---|---|
| User Guide | Comprehensive guide for end users |
| CLI Reference | Complete command-line interface reference |
| Developer Guide | Information for developers and contributors |
| API Reference | Core classes and functions reference |
| BnF Compliance | Details about BnF compliance features |
| Examples | Code examples for API usage |
Command Reference
Document Types
python -m cli.workflow input_dir/ output_dir/ --document-type photograph
photograph: Standard photographic images (default)heritage_document: Historical documents with high-quality settingscolor: General color imagesgrayscale: Grayscale images
Compression Modes
python -m cli.workflow input_dir/ output_dir/ --compression-mode supervised
supervised: Quality-controlled compression (default)lossless: No data losslossy: Higher compression with data lossbnf_compliant: BnF standards with fixed ratios
BnF Mode
python -m cli.workflow input_dir/ output_dir/ --bnf-compliant --metadata bnf_metadata.json
Common Options
For a complete list of all options, see the CLI Reference.
| Option | Description |
|---|---|
--parallel |
Enable parallel processing |
--max-workers N |
Set number of worker threads |
--memory-limit MB |
Set memory limit for large files |
--verbose |
Enable detailed logging |
--log-file PATH |
Save logs to file |
--config PATH |
Use configuration file |
--full-report |
Generate detailed reports with quality metrics |
Current Status and Roadmap
JP2Forge is production-ready with comprehensive JPEG2000 conversion capabilities. Recent improvements include:
✅ Completed (v0.9.6+):
- Refactored codebase with eliminated code duplication
- Shared utility modules for better maintainability
- Enhanced error handling and progress tracking
- Comprehensive testing infrastructure
- Publication-ready codebase structure
🔄 Ongoing Development:
- PyPI package publication
- Comprehensive unit test coverage expansion
- Performance optimization for large datasets
- Docker containerization support
- Extended BnF validation features
Troubleshooting
See the Troubleshooting Guide for common issues and solutions.
License
JP2Forge is released under the MIT License.
Related Project
- JP2Forge Web: A web interface for the JP2Forge JPEG2000 conversion library.
Use Cases
JP2Forge is designed for:
- Cultural Heritage Institutions: Museums, libraries, and archives digitizing collections
- Academic Research: Digital humanities projects requiring high-quality image preservation
- BnF Compliance: Organizations following Bibliothèque nationale de France standards
- Batch Processing: Efficient conversion of large image datasets
- Quality Control: Projects requiring rigorous quality analysis and validation
Acknowledgments
This project follows technical requirements described in BnF reference documents:
JP2Forge serves the digital humanities community and cultural heritage institutions worldwide.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jp2forge-0.9.7.tar.gz.
File metadata
- Download URL: jp2forge-0.9.7.tar.gz
- Upload date:
- Size: 120.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d3bb7b7f55dac51656f6b468eba66a01c22ab30c5c97a2f160c6065739e01c1
|
|
| MD5 |
6ccb1fe4cf2d74c2bd13f67a00a2f3a9
|
|
| BLAKE2b-256 |
f22ef17573f15c5ba8834a9a89b152ae0cb63ab77120649087a82d80a158013c
|
File details
Details for the file jp2forge-0.9.7-py3-none-any.whl.
File metadata
- Download URL: jp2forge-0.9.7-py3-none-any.whl
- Upload date:
- Size: 117.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae2344b7894eb11d6ce96abf3d2bd6ed371b6549d6cc6e3e866445ade0b02f1a
|
|
| MD5 |
d5b1032a54d41044644f0e7ec286e276
|
|
| BLAKE2b-256 |
38933a5a1a5d23fffb9e962c014fb66b964839a9c223fcb3a140ce8c71f54c0c
|