Skip to main content

A module to validate jp2images

Project description

jp2_remediator

PyPI version

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

jp2_remediator on PyPI

Installation

pip install jp2_remediator
python3 -m pip install jp2_remediator

pip install jp2_remediator==NN.NN.NN (version number)

Usage

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

Process one file

python3 src/jp2_remediator/main.py file tests/test-images/7514499.jp2

python3 src/jp2_remediator/main.py file tests/test-images/481014278.jp2

Process directory

python3 src/jp2_remediator/main.py directory tests/test-images/

Process all .jp2 files in an S3 bucket:

python3 src/jp2_remediator/main.py bucket remediation-folder

Process only files with a specific prefix (folder):

python3 src/jp2_remediator/main.py bucket remediation-folder --prefix testbatch_20240923`

Run tests

Run integration tests

pytest src/jp2_remediator/tests/integration/

Run unit tests

pytest src/jp2_remediator/tests/unit/

Docker environment

Build Docker image

./bin/docker-build.sh

Run Docker container as executable

./bin/docker-run.sh -h

Development environment

python3 -m venv myenv
source myenv/bin/activate
export PYTHONPATH="${PYTHONPATH}:src"
pip install -r requirements.txt

python src/jp2_remediator/main.py -h

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jp2_remediator-1.1.0.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jp2_remediator-1.1.0-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file jp2_remediator-1.1.0.tar.gz.

File metadata

  • Download URL: jp2_remediator-1.1.0.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.10

File hashes

Hashes for jp2_remediator-1.1.0.tar.gz
Algorithm Hash digest
SHA256 70f76151b4d39beda842a93f4c8b37982f3b8957f01cc5939d8157f13904dc32
MD5 4b4d25448b05dcf8137b2db0d8430d2a
BLAKE2b-256 b0c46dfc6bada1da21bbc98df1d6abb115e969cdbcc61ec01bd206f477b48f65

See more details on using hashes here.

File details

Details for the file jp2_remediator-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: jp2_remediator-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.10

File hashes

Hashes for jp2_remediator-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d292ea4229e14352645b7e09f318d609e85160441c8e1285831429ba7d2315b4
MD5 bf8f6dc74bce5498c76ad37cd24de8bb
BLAKE2b-256 d7a94af1b00dbadda67e37ec44f03cf7c77d297dd2ad8b266315c650e0dd1784

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page