JP2 (JPEG 2000 Part 1) image validator and properties extractor
Project description
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
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:
-
One toolInfo element, which contains information about jpylyzer (its name and version number)
-
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:
-
fileInfo: general information about the analysed file
-
statusInfo: information about the status of jpylyzer's validation attempt
-
isValid: outcome of the validation
-
tests: outcome of the individual tests that are part of the validation process (organised by box)
-
properties: image properties (organised by box)
-
propertiesExtension: wrapper element for NISO MIX output (only if the
--mix
option is used) -
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. 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')
Steps in preparing a jpylyzer release
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
File details
Details for the file jpylyzer-2.2.1.tar.gz
.
File metadata
- Download URL: jpylyzer-2.2.1.tar.gz
- Upload date:
- Size: 2.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 834ac425946c79878805343c461cba346f3b2d97a910653a1f9e153d9a8243e6 |
|
MD5 | 09baefc7dd2fde201f145cd9de6f70ba |
|
BLAKE2b-256 | f5e8374f6984f2a8a39ef4b1045b3ff4fa86ec6b9201c6d668a96d2b81b78640 |
File details
Details for the file jpylyzer-2.2.1-py2.py3-none-any.whl
.
File metadata
- Download URL: jpylyzer-2.2.1-py2.py3-none-any.whl
- Upload date:
- Size: 52.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f026a857d99f40c0618d1f779504edb805fdb97b128a7d2eeac09a4bca0abada |
|
MD5 | 81def12f6ea81f845a108fc75abe5f43 |
|
BLAKE2b-256 | 82cd28de72ca166be24a1bb5695d45f7ebf40f3d00a60bdc9602a31fccf722c3 |