Skip to main content

png2jxl

png2jxl converts supported PNG images to pixel-lossless JPEG XL while preserving enough information to reconstruct the original PNG byte-for-byte.

Installation

pip install -U png2jxl

Python API

from png2jxl import jxl_to_png, png_to_jxl

source = open("image.png", "rb").read()
archive = png_to_jxl(source)

assert archive is not None
assert jxl_to_png(archive) == source

Encoding and decoding are verified automatically against the original source.

To reject results that are larger than the source PNG:

archive = png_to_jxl(source, effort=10, only_if_smaller=True)

Command line

python -m png2jxl encode image.png   # writes image.jxl
python -m png2jxl decode image.jxl   # writes image.png
python -m png2jxl check image.jxl    # checks for the pngr envelope
  • Use -o/--output to choose an output path; otherwise the extension is swapped automatically.
  • Existing output files are never overwritten.
  • encode supports --effort 1-10, --threads, and --only-if-smaller.
  • Exit codes: 0 success, 1 failure, 2 usage error, 3 rejected by --only-if-smaller.

Pillow integration

Importing png2jxl extends the registered JXL save handler:

import png2jxl
from PIL import Image

with Image.open("image.png") as image:
    image.save(
        "image.png.jxl",
        format="JXL",
        png_reconstruction=True,
        effort=10,
    )

For path-backed PNG images, the original bytes are read from image.filename. For images opened from streams or modified in memory, pass the original bytes explicitly with source_png=source.

Ordinary JXL/JPEG behavior continues to delegate to pillow_jxl.

Supported PNGs

Supported:

  • Static 8-bit L, LA, RGB, and RGBA images
  • 8-bit indexed-color PNGs with a valid PLTE and optional tRNS
  • PNG filters 0–4
  • Consecutive IDAT chunks

Not supported:

  • 1/2/4-bit indexed samples
  • 16-bit samples
  • APNG
  • Indexed images where two used palette entries resolve to the same effective RGBA color

Unused duplicate palette entries are allowed.

Limits and notes

Public functions accept an immutable ResourceLimits value. Defaults allow up to 1 GiB input/output and 512 MiB of filtered plaintext or preflate corrections.

Some generic-viewer color, transparency, or ancillary-metadata behavior may be limited by the upstream pillow_jxl encoder even though the original PNG bytes remain reconstructable. jxl_to_png currently assumes trusted JXL input because the upstream decoder does not expose a dimension-only preflight before pixel allocation.

Dependencies

Development

Metadata

Release files for png2jxl 0.1.0

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

Source distribution (sdist)

Source distribution for png2jxl 0.1.0
File Size Uploaded
png2jxl-0.1.0.tar.gz 57.8 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for png2jxl 0.1.0
File
png2jxl-0.1.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
png2jxl-0.1.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64 Details
png2jxl-0.1.0-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
png2jxl-0.1.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
png2jxl-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
png2jxl-0.1.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
png2jxl-0.1.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
png2jxl-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
png2jxl-0.1.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
png2jxl-0.1.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
png2jxl-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
png2jxl-0.1.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details

Total release size: 4.0 MB

Release files / png2jxl-0.1.0.tar.gz

Download URL png2jxl-0.1.0.tar.gz
Size 57.8 kB
Tags Source
SHA-256 checksum
How to use checksums
961d7e0580d8c5b94e3fec28bc223be0004aba1fb7e763d69292bce297e8aadb
BLAKE2b-256 checksum
How to use checksums
1f264fd7284c31b94e2536ed5eeda5aa9f83586747a3d6d3be24c6effae50b9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / png2jxl-0.1.0-cp314-cp314-win_amd64.whl

Download URL png2jxl-0.1.0-cp314-cp314-win_amd64.whl
Size 269.1 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
03e8aa2e9a0ee9af8ba6b32204f5770ae7bc919d49802078bdae948b2f0f7b63
BLAKE2b-256 checksum
How to use checksums
23bf9185421ffcaec43db87f421238cd111623e6a880dd3642c46d021294ef87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / png2jxl-0.1.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL png2jxl-0.1.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 370.5 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
53477ef0f656643a89cda7d80657ab5c11665120d95275b29456e0d42d65d4e7
BLAKE2b-256 checksum
How to use checksums
955670c8dc7a50ca56be6cee07c5cde569dcb0aefd644aee5f02d92335a83dcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / png2jxl-0.1.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL png2jxl-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
Size 335.6 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d29a9b419b5b05657c97adcdf857aa7b28b3546da5df55fe8b95cd0a4ab9a35c
BLAKE2b-256 checksum
How to use checksums
b8c0c95571f33fa61fd6cf3db050b3548a405a7b6d931bf03d5efe8d2e7c4400
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / png2jxl-0.1.0-cp313-cp313-win_amd64.whl

Download URL png2jxl-0.1.0-cp313-cp313-win_amd64.whl
Size 269.3 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
ecd15e0e47ad19bd448e3cc9592f935e7c9a761ddf7fdc4020f80ab405d51ff1
BLAKE2b-256 checksum
How to use checksums
01f902f4b8a4539d95daa54b42b57f1fa511f7d2b65716e966e77d93d2d32f4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / png2jxl-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL png2jxl-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 370.4 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
bdf7a0c5f4a14ffc12951f5b95d49fcef55b7b2cb5c2be8c7dea6f6e82db11ab
BLAKE2b-256 checksum
How to use checksums
4141b3ab7bfdd243a85e46df3a943a8e04aad823b993ccfa46de7a1e819e896d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / png2jxl-0.1.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL png2jxl-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Size 335.5 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c644bac4dfed15ee88c40d31257cc42a1053c43addfab8b438061dc106290318
BLAKE2b-256 checksum
How to use checksums
19a34a56712c7cacf1607006c3bb1d294abee6eaa0de8d526689a58e49681c23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / png2jxl-0.1.0-cp312-cp312-win_amd64.whl

Download URL png2jxl-0.1.0-cp312-cp312-win_amd64.whl
Size 269.6 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
75c9222410a38f39d14037a4760675a54fad72f7204372763ce7dc84d26bc628
BLAKE2b-256 checksum
How to use checksums
cf71d660b3ebd5d0a2e899f4d526021ee83b899639c62571174e53864eb13373
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / png2jxl-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL png2jxl-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 370.6 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
9729a4b3f9ff64179a5f7c9fc3f033a38d19d2bcd740bc17a4c732e68995b0fc
BLAKE2b-256 checksum
How to use checksums
813b7185ea375eb6152ace4b70241f1f3a5421e4e1f5df7b280add0f3ec71075
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / png2jxl-0.1.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL png2jxl-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Size 335.7 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
77f150cd2288cef6fe569bbf1a89b86bc92a272d0dbf997fae82aab213e4ce54
BLAKE2b-256 checksum
How to use checksums
6069b60d6eec9296a685b69200565bd71e14a6bf083beb0312725b489947f519
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / png2jxl-0.1.0-cp311-cp311-win_amd64.whl

Download URL png2jxl-0.1.0-cp311-cp311-win_amd64.whl
Size 272.0 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
d64e68f28d52e67b08e5f346a9bb34304f47daca7d62c3d62996690d2ca61462
BLAKE2b-256 checksum
How to use checksums
acd420c71d35625b643f6181274c5badb4058bef6d404d6699f24c7e35a2dbed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / png2jxl-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL png2jxl-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 371.1 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
f77e715f6ef8955e1f777f382854c8c864e3a600fd233d5a8ecc2304117b4cd9
BLAKE2b-256 checksum
How to use checksums
cf78dabbf3c6c8ef0642dd51c84c3249adfa05a834b040b3e7e1764378138c5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / png2jxl-0.1.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL png2jxl-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Size 337.9 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b01e8898eed6d277f1a4af10406cc14a2a0eed6b74c8826caa45e5a54f0587f4
BLAKE2b-256 checksum
How to use checksums
7270403251d4ae4c2cd43978a48f7b968f1eb6ab5762b7e4f125cd6fcb1efafd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.0

13 release files

This release

0.1.0 This release

13 release files

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