A Python wrapper for openjpeg, with a focus on use as a plugin for for pylibjpeg
Reason this release was yanked:
Use v2.3.0 for numpy v2.0
Project description
pylibjpeg-openjpeg
A Python 3.8+ wrapper for openjpeg, with a focus on use as a plugin for pylibjpeg.
Linux, OSX and Windows are all supported.
Installation
Dependencies
Installing the current release
python -m pip install -U pylibjpeg-openjpeg
Installing the development version
Make sure Python, Git and CMake are installed. For Windows, you also need to install Microsoft's C++ Build Tools.
git clone --recurse-submodules https://github.com/pydicom/pylibjpeg-openjpeg
python -m pip install pylibjpeg-openjpeg
Supported JPEG Formats
Decoding
ISO/IEC Standard | ITU Equivalent | JPEG Format |
---|---|---|
15444-1 | T.800 | JPEG 2000 |
Encoding
Encoding of NumPy ndarrays is supported for the following:
- Array dtype: bool, uint8, int8, uint16, int16, uint32 and int32 (1-24 bit-depth only)
- Array shape: (rows, columns) and (rows, columns, planes)
- Number of rows/columns: up to 65535
- Number of planes: 1, 3 or 4
Transfer Syntaxes
UID | Description |
---|---|
1.2.840.10008.1.2.4.90 | JPEG 2000 Image Compression (Lossless Only) |
1.2.840.10008.1.2.4.91 | JPEG 2000 Image Compression |
1.2.840.10008.1.2.4.201 | High-Throughput JPEG 2000 Image Compression (Lossless Only) |
1.2.840.10008.1.2.4.202 | High-Throughput JPEG 2000 with RPCL Options Image Compression (Lossless Only) |
1.2.840.10008.1.2.4.203 | High-Throughput JPEG 2000 Image Compression |
Usage
With pylibjpeg and pydicom
from pydicom import dcmread
from pydicom.data import get_testdata_file
ds = dcmread(get_testdata_file('JPEG2000.dcm'))
arr = ds.pixel_array
Standalone JPEG decoding
You can also decode JPEG 2000 images to a numpy ndarray:
from openjpeg import decode
with open('filename.j2k', 'rb') as f:
# Returns a numpy array
arr = decode(f)
# Or simply...
arr = decode('filename.j2k')
Standalone JPEG encoding
Lossless encoding of RGB with multiple-component transformation:
import numpy as np
from openjpeg import encode_array
arr = np.random.randint(low=0, high=65536, size=(100, 100, 3), dtype="uint8")
encode_array(arr, photometric_interpretation=1) # 1: sRGB
Lossy encoding of a monochrome image using compression ratios:
import numpy as np
from openjpeg import encode_array
arr = np.random.randint(low=-2**15, high=2**15, size=(100, 100), dtype="int8")
# You must determine your own values for `compression_ratios`
# as these are for illustration purposes only
encode_array(arr, compression_ratios=[5, 2])
Lossy encoding of a monochrome image using peak signal-to-noise ratios:
import numpy as np
from openjpeg import encode_array
arr = np.random.randint(low=-2**15, high=2**15, size=(100, 100), dtype="int8")
# You must determine your own values for `signal_noise_ratios`
# as these are for illustration purposes only
encode_array(arr, signal_noise_ratios=[50, 80, 100])
See the docstring for the encode_array() function for full details.
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 Distributions
Hashes for pylibjpeg_openjpeg-2.2.2-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b091e760c4e2f0be9eec376742b172f7b300798ed35cf9039bfa8757e6d77bf8 |
|
MD5 | 6d6a0d5a16621e22dda3585446de4c44 |
|
BLAKE2b-256 | 87970952d99075508536959f97529e69479a36b38f25c875a7969653c66a395f |
Hashes for pylibjpeg_openjpeg-2.2.2-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 905e76c780f4e6be10312141c27286ece57cd1de0b67058371eb46a014900021 |
|
MD5 | c26c8e6352a414d9e6fe97eb3057d663 |
|
BLAKE2b-256 | 650244aaa402ace763b8b00e620510e11a5976493cdb0a105b8e45fc80a10d26 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1c686d8d622774c72070033e70e82db887cfacc0b45299ab00877ba8516d6aa |
|
MD5 | 8913b617489fd198dc553db8b4f9b295 |
|
BLAKE2b-256 | 9a2b54fd20291c3933387c25f9972baea490e4d0f8370f996159a530fe3e90d2 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edfdb3d9b96873e726d0beb588ac39f4b72a279fad8685c4a234beb9c5ce4ef6 |
|
MD5 | 6fb95c98c9fb446bafdca9c33b027fff |
|
BLAKE2b-256 | 172d537be505fcabf07730e189a0aecdf43e1e0b614ca7d1382e344a2276733e |
Hashes for pylibjpeg_openjpeg-2.2.2-cp312-cp312-macosx_14_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c139791b86ef86be1e5395de91193cbb724444299002e57024f54ff5c466d7a0 |
|
MD5 | cf081f4b6ae6f01a30d188ac94ab3f68 |
|
BLAKE2b-256 | 46f570083e3484e21174285f68e0aaee79ee5461cea26bc7ad8695fe78d046bf |
Hashes for pylibjpeg_openjpeg-2.2.2-cp312-cp312-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 934feeb2a0c3caa239e4ab4f345dd4337ba48923ecb0a4c6cd7ad1d02b240fa0 |
|
MD5 | 08ebff9e96c2faddba566b377a16040e |
|
BLAKE2b-256 | 5809bb0897505a6acb6350eb47e40d8a78c9ab8abdb8b11b5c13174f6ae20200 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d185d421da9536f2958661ee4c1d7c6996df54ba26dd862c74c4e57f8dac2cd8 |
|
MD5 | 04f32d066e2d52d04cc3d80b9cccedc3 |
|
BLAKE2b-256 | 8284d7e70b2a7fe50d4f366b1f1fa36583a77e240e715d7d15dd584203a8a65a |
Hashes for pylibjpeg_openjpeg-2.2.2-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 847472fa4f26cd6afe0349a22e5dcf7c3f8d9d3e486781098538c26022764ba8 |
|
MD5 | 7ed4d75403fec18ed6d857b8fa7e5a23 |
|
BLAKE2b-256 | 8038288fe1962695bea16bb419475ae987e535a3c7c9af2467fbd38941cfae76 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfac942506d859746387a38319276e85ffd802370263a5b33d7e1479262dd62e |
|
MD5 | da08c97966bb688d5decc5788d4f7bb6 |
|
BLAKE2b-256 | 8031c7e301a61d95db08b64521ea2e7950316edae31ec57bc0325fe221a0f8aa |
Hashes for pylibjpeg_openjpeg-2.2.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4659260d856c5f1e6067d2e67ffc46096e470394ad904e3f4154e36d77e8fe51 |
|
MD5 | 3734e4b511e5ec34da7076f05e79bd0f |
|
BLAKE2b-256 | 59c4c5221032a100b5b1f721101a23a71bf6927ac8c10e3b5332f9406f057822 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp311-cp311-macosx_14_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af2578380696064808d2a6e2808306d9601c718e199c6301dbfe2d3b5e3abd7a |
|
MD5 | 0e8e7b4f94848f2726c1aba0f6a41625 |
|
BLAKE2b-256 | 46ea9134faeed3db1a931daa8eda84bc802fee368610cad02bf2f1d605997ff2 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp311-cp311-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf9bd7fd5faed00b73fbf5ec59847b8d8233f04cfdc966819a7001847b99ba40 |
|
MD5 | cfaa593f8cbf16702cc60a1daec45b08 |
|
BLAKE2b-256 | dbf27ec59c49625354984b64954f7eaa117fef5d88cd9540581a19ac0b53ddef |
Hashes for pylibjpeg_openjpeg-2.2.2-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e5d166a7bfdb0c551b76fbc1323906d0f8fc83949df50577f21714063ba0547 |
|
MD5 | 0663e6b51f8b3528cedfda5fc3715664 |
|
BLAKE2b-256 | 850e4e4a0a2685b2593b991d276cb26a963a26392bc7cb2c07b597fbedba87ab |
Hashes for pylibjpeg_openjpeg-2.2.2-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc6e2c4ded57972a5d6d9b6aca2cce489fdc7ccb74dd4d86f2b7b12f80eaae9a |
|
MD5 | b0ab8a08854f0a3a4dcea3350710910c |
|
BLAKE2b-256 | 51922f73df9529bf66ed3e810a7e3535b46f9c3160b2e294e900ea76babb8e66 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa74efd0f8244f790771aaf972c89e8d2437e810a5a348a7bbaa30325d9067bd |
|
MD5 | 33d90e3ae0b626f2fef1d8a8d174637d |
|
BLAKE2b-256 | 984ccb2834efcd81cf8ad0662ccd46042ce893cab43c35e0844a1bb0a621dc49 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7337f18afff4460dc816d53c62dd1e46fc787ce5edaf40e1ee5fd705c6a88a09 |
|
MD5 | 4022a81e071138acb536f44b4003b7fe |
|
BLAKE2b-256 | aac8bee31c67aa6ff9cac1a9de2f8262a41e59d21876f4ff23a8d8d58916a445 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp310-cp310-macosx_14_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21a07597bf6ccc6859ee3cb41cfb496e2cb2f356c099c07a697f3ee00f14723a |
|
MD5 | 8e4cc4a66f3dedf6a359a1258c897fd1 |
|
BLAKE2b-256 | d89b7abd5dc0694b828a2f54b744936fb4b51f13b5b2912ab1984728363999b3 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4890acc5f7c8882e45d0de6e65feb8501932e44ef9d6bdb49e8edad64b09706c |
|
MD5 | 26cf176280bbfd759df6c7cb4befb862 |
|
BLAKE2b-256 | 8848972eff811858cb8ff52169ff557beb42052ffa11d537ac8cc215a94e0e9c |
Hashes for pylibjpeg_openjpeg-2.2.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ced165f59623d2291184706c0bc7331872bb83740092d7463bea23f0f19b7f6a |
|
MD5 | d868c1dda8ff346dcafa718d595dfe26 |
|
BLAKE2b-256 | 22528da7083d811d4ce47e8f2d8c3201be1721ae61fddafc8bdd05957d592063 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68a5c77482a9a4b36f4e7ea049ed886f2484667855ae8e51ab28c30a6f488aad |
|
MD5 | 3b0fe61cbe1296fcc87f70b23f9e950a |
|
BLAKE2b-256 | 63ccec7192e52ade10eea58fba06c2edade59bf119291c83fbb5fc243a6841c4 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edce79b88a0e1943d825d965387d1005a5341babfe8f84316ed7872b6296e56f |
|
MD5 | 2fc4af7e1754544897aa81f24a72f58d |
|
BLAKE2b-256 | d1e955d359fa82be0d63c4fb9006d981c16f0ee48764d53cc1a3a5e086648c06 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e87317a03115ad629366decd03ea8cddd226a7aa09f7e889983db5139c335b8 |
|
MD5 | 608226e4908e002a2dc72ed80af334db |
|
BLAKE2b-256 | 6b41b30fcbd04c31963bfe6ca8f72cfdbf8785fe1baf7e444c39b23d460f3731 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp39-cp39-macosx_14_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 747ec088822dc74b99ed7f58bbf57db2c34937d7154977e902ded04d27f0a204 |
|
MD5 | 9a49ebdb4ec66de74fbcc62c8c4973bc |
|
BLAKE2b-256 | 9e68308e7c7f88b9cc25abec26d8ae570a3d98ec92f253dd3feaa534256aa033 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64168a086a4fe4b8ec72b76d1ac34ecbee366883c9077d42fc8918d8c12bf0e3 |
|
MD5 | 7f84785529f79165701f729dd7259d32 |
|
BLAKE2b-256 | 7244fe67a5d4dd0401e409d45ea6620af128a75024f05fff19211f7e831451a6 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cc325921754638daa238adc919a37212d4f7a7fed75c9a8787f46eee0ebfdaa |
|
MD5 | 0d4a7deb75e89467a93a4ac7d6313e83 |
|
BLAKE2b-256 | 6442ef6502b4f04412e098a88a6286860ac8fe1d6867ba2253f42a5d5d3e4aca |
Hashes for pylibjpeg_openjpeg-2.2.2-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59e71e04be3f612685c07fdd6786ffd82f91446b4c58e937d9d6c19b31b0fd69 |
|
MD5 | df48ddbfaf5a765e9d8d635d25f84bfe |
|
BLAKE2b-256 | 1670e898f6b1d51e01d391f3f6aea3255653b5377150056a3d4cc92eeff6fe62 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4579a5bc37f11aace1c87e3826ab9be4e69f1a2d2d4c0933026334e70d3f77d |
|
MD5 | b7420a1857b8b4784f0e924be43d51f4 |
|
BLAKE2b-256 | 6d11ae7be0200ffa2807b138c63956499c0134c0d1bf3c4254392a321b8c39f8 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74d6731b5a15059ba6449a11f73d6ad24e886a42ee5a656bca04364a242a2ab0 |
|
MD5 | 2f0c4e0d451fa7ab13399a7d7b2ac3b9 |
|
BLAKE2b-256 | ec01bbae2c95baa230afc559a83e7480b42166d88559b48e50d441aeae5eac52 |
Hashes for pylibjpeg_openjpeg-2.2.2-cp38-cp38-macosx_14_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d1a9efa2dd8b7786289eb8cd86c57e175ca1be1cd01278d756a72461a22f8d0 |
|
MD5 | c59646ab0b19738214b91dec8330af93 |
|
BLAKE2b-256 | 61dfaf593f0e190be7ae3eaa3108e674197c33f6334cc69eb39d42fcb250b45d |
Hashes for pylibjpeg_openjpeg-2.2.2-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c8a7a9b8f24a32f197cdc6bd4509d68881be9facf51b92c684c9b959fec2bf0 |
|
MD5 | 6161842b44666c7e1f423a007d46dc92 |
|
BLAKE2b-256 | 77c9d8c1cad422ad98b618d2d61c331e4048a74ca8b3f1ca3f8a02095fbcfa75 |