A Python module to validate jp2 images:
- reads the bytes of a jp2 file or directory of files or S3 bucket
- looks for presence of ICC profile
- maps and validates curv values according to the ISO/IEC 15444-1:2019 (E) and ICC.1:2022 Specifications
- corrects values where the rTRC/gTRC/bTRC tag size in the Tag table structure (ICC.1:2022 Table 24 tag size) is not the same as the count value (gamma, where n == 1) in the curveType encoding (ICC.1:2022 Table 35, n value)
- flag and (optionally) log values where the count value n != 1 for future review
pip install jp2_remediator
python3 -m pip install jp2_remediator
pip install jp2_remediator==NN.NN.NN (version number)
python3 src/jp2_remediator/main.py -h
usage: main.py [-h] {file,directory,bucket} ...
JP2 file processor
options:
-h, --help show this help message and exit
Input source:
{file,directory,bucket}
file Process a single JP2 file
directory Process all JP2 files in a directory
bucket Process all JP2 files in an S3 bucket
python3 src/jp2_remediator/main.py file tests/test-images/7514499.jp2
python3 src/jp2_remediator/main.py file tests/test-images/481014278.jp2
python3 src/jp2_remediator/main.py directory tests/test-images/
python3 src/jp2_remediator/main.py bucket remediation-folder
python3 src/jp2_remediator/main.py bucket remediation-folder --prefix testbatch_20240923`
pytest src/jp2_remediator/tests/integration/
pytest src/jp2_remediator/tests/unit/
Build Docker image
./bin/docker-build.sh
Start Docker container
./bin/docker-run.sh
python3 -m venv myenv
source myenv/bin/activate
export PYTHONPATH="${PYTHONPATH}:src"
pip install -r requirements.txt
python src/jp2_remediator/main.py -h