Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

jpylyzer

About

Jpylyzer is a JP2 (JPEG 2000 Part 1) image validator and properties extractor. Its development was partially supported by the SCAPE Project. The SCAPE project is co-funded by the European Union under FP7 ICT-2009.4.1 (Grant Agreement number 270137).

Jpylyzer homepage

Please visit the jpylyzer homepage for links to the most recent package downloads (Debian packages and Windows binaries), and a User Manual which documents all aspects of the software:

https://jpylyzer.openpreservation.org/

CI Status

  • Build Status Travis-CI

  • Build Status OPF Jenkins

Using jpylyzer from the command line

Calling jpylyzer in a command window without any arguments results in the following helper message:

usage: jpylyzer [-h] [--format FMT] [--mix {1,2}] [--nopretty]
            [--nullxml] [--recurse] [--packetmarkers] [--verbose]
            [--version] jp2In [jp2In ...]

Positional arguments

Argument Description
jp2In input image(s), may be one or more (whitespace-separated) path expressions; prefix wildcard (*) with backslash (\) in Linux

Optional arguments

Argument Description
[-h, --help] show help message and exit
[--format FMT] validation format; allowed values are jp2 (JPEG 2000 Part 1, used by default), j2c (Part 1 codestream), jph (JPEG 2000 Part 15 / High Throughput JPEG 2000) and jhc (Part 15 codestream)
[--mix {1,2}] report additional output in NISO MIX format (version 1.0 or 2.0)
[--nopretty] suppress pretty-printing of XML output
[--nullxml] extract null-terminated XML content from XML and UUID boxes(doesn't affect validation)
[--recurse, -r] when analysing a directory, recurse into subdirectories
[--packetmarkers] Report packet-level codestream markers (plm, ppm, plt, ppt)
[--verbose] report test results in verbose format
[-v, --version] show program's version number and exit

Output

Output is directed to the standard output device (stdout).

Examples

Validate JP2 image:

jpylyzer rubbish.jp2 > rubbish-jp2.xml`

Validate JPEG 2000 Part 1 codestream:

jpylyzer --format j2c rubbish.j2c > rubbish-j2c.xml`

Validate JPH (High Throughput) image:

jpylyzer --format jph rubbish.jph > rubbish-jph.xml`

Validate JPEG 2000 Part 15 (High Throughput) codestream:

jpylyzer --format jhc rubbish.jhc > rubbish-jhc.xml`

In the above examples, output is redirected to the output files ‘rubbish-???.xml’. By default jpylyzer’s XML is pretty-printed, so you should be able to view the file using your favourite text editor. Alternatively use a dedicated XML editor, or open the file in your web browser.

Output format

The output file contains the following top-level elements:

  1. One toolInfo element, which contains information about jpylyzer (its name and version number)

  2. One or more file elements, each of which contain information about about the analysed files

In turn, each file element contains the following sub-elements:

  1. fileInfo: general information about the analysed file

  2. statusInfo: information about the status of jpylyzer's validation attempt

  3. isValid: outcome of the validation

  4. tests: outcome of the individual tests that are part of the validation process (organised by box)

  5. properties: image properties (organised by box)

  6. propertiesExtension: wrapper element for NISO MIX output (only if the --mix option is used)

  7. warnings: reported warnings

Using jpylyzer as a Python module

Instead of using jpylyzer from the command-line, you can also import it as a module in your own Python programs. To do so, install jpylyzer with pip in a virtual environment:

pip install jpylyzer

Then import jpylyzer into your code by adding:

from jpylyzer import jpylyzer

Subsequently you can call any function that is defined in jpylyzer.py. In practice you will most likely only need the checkOneFile function. The following minimal script shows how this works:

#! /usr/bin/env python3

from jpylyzer import jpylyzer

# Define JP2
myFile = "/home/johan/jpylyzer-test-files/aware.jp2"

# Analyse with jpylyzer, result to Element object
myResult = jpylyzer.checkOneFile(myFile)

# Return image height value
imageHeight = myResult.findtext('./properties/jp2HeaderBox/imageHeaderBox/height')
print(imageHeight)

Here, myResult is an Element object that can either be used directly, or converted to XML using the ElementTree module[^3].

For validation a raw JPEG 2000 codestreams, call the checkOneFile function with the additional validationFormat argument, and set it to j2c:

# Define Codestream
myFile = "/home/johan/jpylyzer-test-files/rubbish.j2c"

# Analyse with jpylyzer, result to Element object
myResult = jpylyzer.checkOneFile(myFile, 'j2c')

Validator modules and classes

As of Jpylyzer 2.3, the validator functions are spread across 6 modules, each of which contains a validator class. These validator classes are all child classes of the "Validator" base class that is defined in validator.py:

  • jp2.py - Top-level JP2 / JPH validation (class JP2Validator)
  • boxes.py - Validation of all defined boxes for JP2 and JPH (class BoxValidator)
  • codestream.py - JPEG 2000 codestream validation (class CSValidator)
  • tilepart.py - Validation of one tile part of a JPEG 2000 codestream (class TilePartValidator)
  • csmarkers.py - Validation of JPEG 2000 codestream marker segments (class CSMarkerValidator)
  • icc.py - Feature extraction from an ICC profile (class IccValidator)

The table below shows how each higher-level classe imports all classes that are needed for validation at the underlying level:

Validator class Imported validator classes
JP2Validator BoxValidator
BoxValidator CSValidator, IccValidator
CSValidator TilePartValidator, CSMarkerValidator
TilePartValidator CSMarkerValidator
CSMarkerValidator -
IccValidator -

Steps in preparing a jpylyzer release

See instructions here

Metadata

Release files for jpylyzer 2.3.0rc2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jpylyzer 2.3.0rc2
File Size Uploaded Provenance
jpylyzer-2.3.0rc2.tar.gz 2.3 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for jpylyzer 2.3.0rc2
File Interpreter ABI Platform
jpylyzer-2.3.0rc2-py3-none-any.whl Python 3 none any Details

Total release size: 2.3 MB

Release files / jpylyzer-2.3.0rc2.tar.gz

Download URL jpylyzer-2.3.0rc2.tar.gz
Size 2.3 MB
Tags Source
SHA-256 checksum
How to use checksums
ea62b73b491283cf6be2f6981fdd1df0b55f6b3516e45f819a244f52b1f1e17c
BLAKE2b-256 checksum
How to use checksums
4731baf653b6f1463720c3efea1230c1755f95c45f05198d2bd86443aa0c904a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / jpylyzer-2.3.0rc2-py3-none-any.whl

Download URL jpylyzer-2.3.0rc2-py3-none-any.whl
Size 58.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4717fbf4cf29c2c43c489183bd49131e33ceab1aac00225101c139f0f13f7a00
BLAKE2b-256 checksum
How to use checksums
c4da022575ec37d166ec15db2a3ce1ffe61ea4ea0378de486f837b27dc504be7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for jpylyzer 2.3.0rc2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page