opentile-jpeg
Lossless JPEG operations that work directly on the compressed DCT coefficients: crop, compose (re-tile), optimize and fill, plus coefficient access as numpy arrays. Pixels are never decoded or re-encoded, so there is no quality loss.
Built on libjpeg-turbo, which is bundled in the wheels: no system install needed.
Install
pip install opentile-jpeg
Use
import opentile_jpeg
# Crop a region (x, y, width, height).
tile = opentile_jpeg.crop(jpeg, 512, 0, 512, 512)
# Crop many regions from one source, decoded once; crops are produced lazily.
for tile in opentile_jpeg.crop_multiple(jpeg, [(0, 0, 512, 512), (512, 0, 512, 512)]):
...
# Crop past the right/bottom edge, filling outside the image with a color.
edge_tile = opentile_jpeg.crop(jpeg, 1536, 0, 512, 512, background=255)
# Shrink with optimal Huffman tables.
smaller = opentile_jpeg.optimize(jpeg)
# A solid-color tile with the template's size and encoding.
blank = opentile_jpeg.fill(template, (255, 255, 255))
# Re-tile sources placed on a grid at (gx, gy), e.g. overlapping scanner tiles,
# into output tiles at the given positions.
for tile in opentile_jpeg.compose(
[(left, 0, 0), (right, 1, 0)],
content_size=(448, 448), # source size minus overlap
tile_size=(512, 512),
positions=[(0, 0), (512, 0)],
):
...
# Edit DCT coefficients and encode them back.
coeffs, info = opentile_jpeg.decode_coefficients(jpeg)
coeffs[0][:, :, 1:, :] = 0 # one (rows, cols, 8, 8) int16 array per component
edited = opentile_jpeg.encode_coefficients(coeffs, info)
Positions and sizes must follow the source's MCU grid, given by its subsampling
(see opentile_jpeg.header):
| Subsampling | MCU (width × height) |
|---|---|
| 4:4:4 | 8 × 8 |
| 4:2:2 | 16 × 8 |
| 4:4:0 | 8 × 16 |
| 4:2:0 | 16 × 16 |
| 4:1:1 | 32 × 8 |
Metadata
Outputs keep the source's metadata (ICC profile, EXIF, XMP, comments) by
default. Remove any of it with strip:
opentile_jpeg.crop(jpeg, 0, 0, 512, 512, strip=opentile_jpeg.Metadata.EXIF)
EXIF is copied as is, so after a crop or compose its dimensions and thumbnail still describe the source.
Errors and warnings
- Invalid arguments, such as a region off the MCU grid, raise
ValueError. - JPEG data libjpeg-turbo cannot read raises
opentile_jpeg.JpegError. - Problems libjpeg-turbo recovers from, such as a truncated file, issue a
opentile_jpeg.JpegWarning. - A JPEG claiming more pixels than
max_pixelsraisesopentile_jpeg.JpegTooLargeError(aJpegError) before anything is allocated for it. Every operation that reads an image takesmax_pixels, by defaultopentile_jpeg.DEFAULT_MAX_PIXELS(about 179 million pixels, Pillow's limit). Pass a larger value, orNone, to the call that reads a legitimately larger image; the limit applies to that call only.
License
opentile-jpeg is licensed under Apache-2.0. The wheels include libjpeg-turbo, under
the IJG and BSD-3-Clause licenses, whose texts are in licenses/.
This software is based in part on the work of the Independent JPEG Group.
Metadata
Release files for opentile-jpeg 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| opentile_jpeg-0.1.0.tar.gz | 54.5 kB | Without provenance | Details for opentile_jpeg-0.1.0.tar.gz |
Built distributions (wheels)
Total release size: 4.5 MB
Release files / opentile_jpeg-0.1.0.tar.gz
| Download URL | opentile_jpeg-0.1.0.tar.gz |
|---|---|
| Size | 54.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a54247279e94781b08238fe92d974aba8d8012fde6077b0c4818314034449b2e
|
|
BLAKE2b-256 checksum How to use checksums |
bfe39c71056bc0d02ef38006c43362dc26bd11c70dbb58aff44a68d94ba301e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp312-abi3-win_arm64.whl
| Download URL | opentile_jpeg-0.1.0-cp312-abi3-win_arm64.whl |
|---|---|
| Size | 531.6 kB |
| Tags | CPython 3.12 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
0ec32b3b92a1b4c1e57ef9e70b71fca4014b6fd41ab7409d3e884c23e747abe9
|
|
BLAKE2b-256 checksum How to use checksums |
070571de048ba2893f17a2d529053317a9c3b5555a9a7c6684873b64aaa00834
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp312-abi3-win_amd64.whl
| Download URL | opentile_jpeg-0.1.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 378.8 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b93926d0d1708ded6b814a65bd242963405192fb546ad44cf0d11b390bb0b11b
|
|
BLAKE2b-256 checksum How to use checksums |
accf6c52baf5c5d115b6c1fb6104530797b61cf850580daf7f16abb28b43a961
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp312-abi3-musllinux_1_2_x86_64.whl
| Download URL | opentile_jpeg-0.1.0-cp312-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 266.2 kB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
416e1ad04f3043999141cf6c44bf323b38d46c0d3df17f11362069ff431895e5
|
|
BLAKE2b-256 checksum How to use checksums |
db3e66f7cb91dabc712e5b61d1e95f2b70155f51547ef52519f4e83f2185c2dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp312-abi3-musllinux_1_2_aarch64.whl
| Download URL | opentile_jpeg-0.1.0-cp312-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 258.3 kB |
| Tags | CPython 3.12 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
c8b38f79a520433d531d1503d99d618107c167d641c155d2e45d233d9a7f04fa
|
|
BLAKE2b-256 checksum How to use checksums |
0f072603343eeb992893cf0ef6f283dcc4618997b94a76e234735a2288df8c3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | opentile_jpeg-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 210.9 kB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a489b8fe5adb60d71105aa37bfd5060bd3060147cd197b156fb3c32368bcd436
|
|
BLAKE2b-256 checksum How to use checksums |
472ee0692cff7d52baa8d7ae75e9d08f6152e5792df98cf6814afd3e7b4c0540
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | opentile_jpeg-0.1.0-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 202.4 kB |
| Tags | CPython 3.12 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
51af830780d7fc1050b4489fa99d1832df7cd4d528568ec067b41d3249856a73
|
|
BLAKE2b-256 checksum How to use checksums |
d911e3193d4794ac4895475592e56aca9b6dd1300a16494790c96354c1f8d09f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | opentile_jpeg-0.1.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 169.6 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b6dc70ca7c001ac90312e1f912274b377a22aaf398820bc19ed925e3455ba80f
|
|
BLAKE2b-256 checksum How to use checksums |
ff111a9fee40add7cb62511e581cfef5b7a328a0a1b82f4f0617037be567555a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp312-abi3-macosx_10_15_x86_64.whl
| Download URL | opentile_jpeg-0.1.0-cp312-abi3-macosx_10_15_x86_64.whl |
|---|---|
| Size | 190.0 kB |
| Tags | CPython 3.12 abi3 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
b550da2d1b04f7e394329c4e8a29120f379d0ada4c6718e311c84fe6cb825940
|
|
BLAKE2b-256 checksum How to use checksums |
ee75ac47f78f3e39374bed30bf7eaa64469e290ceab4ec6f4e9ae12be5dab63c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp311-cp311-win_arm64.whl
| Download URL | opentile_jpeg-0.1.0-cp311-cp311-win_arm64.whl |
|---|---|
| Size | 532.8 kB |
| Tags | CPython 3.11 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
983c11d7fe91b7fb38ec282e1745d81f5e91d9533edbc5c2c74c48719d4c7bf5
|
|
BLAKE2b-256 checksum How to use checksums |
2928ed9f23f7cbe2ce16529d3f14db660dd0c2c2bdc1a21782c328d9aa0924c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp311-cp311-win_amd64.whl
| Download URL | opentile_jpeg-0.1.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 379.4 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b779b1c0e1c81313d913102a17806c2bd5b48d26b8b678a9142324deeac9e3ab
|
|
BLAKE2b-256 checksum How to use checksums |
251512aaf62b24e8f5f2236ae1b9d7aa1147e948a1b9df3d18f9396d21f2d370
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp311-cp311-musllinux_1_2_x86_64.whl
| Download URL | opentile_jpeg-0.1.0-cp311-cp311-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 270.4 kB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
9e0280ffde3726559a4ed4fbb8ac5a7b67eb94280c10bd2f68911a8318330556
|
|
BLAKE2b-256 checksum How to use checksums |
4ff1a33c3d078709fac7a9ba6b153cc963ec2487cabfc95fc0d6b27b2659c846
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp311-cp311-musllinux_1_2_aarch64.whl
| Download URL | opentile_jpeg-0.1.0-cp311-cp311-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 262.6 kB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
f9511c2d6c5192956c8a81cb73437717a580d0164448ac550f3c9bfeffd102f4
|
|
BLAKE2b-256 checksum How to use checksums |
7c1cee8306f5b1595c354a1e9adf74064350332ee41c131248d57b92768404e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | opentile_jpeg-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 215.1 kB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
8d5808c42b0d7212e94cc412cddefe508de3f6c097f1af6df63276580db52dac
|
|
BLAKE2b-256 checksum How to use checksums |
cde3a6dde92d36e030c140c2f1a05026530914af6060e8aba91690190548426e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
| Download URL | opentile_jpeg-0.1.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 206.5 kB |
| Tags | CPython 3.11 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
ed045686ab8ff69c52b0f5951566befe32c66c3b220c3b4d4563db1700deef23
|
|
BLAKE2b-256 checksum How to use checksums |
4204160ef8b42549f95451e57f285dba47a170987f86ed287c914ab64aa1d502
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | opentile_jpeg-0.1.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 171.9 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b03368b4d1d728d1be358f5d753481fafc3671d37759b7aa828d21099f43fdae
|
|
BLAKE2b-256 checksum How to use checksums |
f42140325151c2d9b903b68f45f57de212022a058794f12c7ffe4a3809ed515a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / opentile_jpeg-0.1.0-cp311-cp311-macosx_10_15_x86_64.whl
| Download URL | opentile_jpeg-0.1.0-cp311-cp311-macosx_10_15_x86_64.whl |
|---|---|
| Size | 191.9 kB |
| Tags | CPython 3.11 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
78d1dd92987ec8915526453e4902a13ffeef8aee696b80930412e4405cb3c315
|
|
BLAKE2b-256 checksum How to use checksums |
04fe60b2db6f0363910606078d578b6445f1e94c327c9103953580661e831f21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for opentile-jpeg 0.1.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.