LastPNGImagePlugin 0.2.0__tar.gz → 999__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lastpngimageplugin-999/LastPNGImagePlugin.egg-info/PKG-INFO +12 -0
- lastpngimageplugin-999/LastPNGImagePlugin.egg-info/SOURCES.txt +7 -0
- lastpngimageplugin-999/LastPNGImagePlugin.egg-info/dependency_links.txt +1 -0
- lastpngimageplugin-999/LastPNGImagePlugin.egg-info/top_level.txt +1 -0
- lastpngimageplugin-999/PKG-INFO +12 -0
- lastpngimageplugin-999/README.md +1 -0
- lastpngimageplugin-999/pyproject.toml +3 -0
- lastpngimageplugin-999/setup.cfg +4 -0
- lastpngimageplugin-999/setup.py +25 -0
- lastpngimageplugin-0.2.0/.gitignore +0 -4
- lastpngimageplugin-0.2.0/LICENSE +0 -21
- lastpngimageplugin-0.2.0/PKG-INFO +0 -148
- lastpngimageplugin-0.2.0/README.md +0 -135
- lastpngimageplugin-0.2.0/decoder/Cargo.lock +0 -102
- lastpngimageplugin-0.2.0/decoder/Cargo.toml +0 -14
- lastpngimageplugin-0.2.0/decoder/src/lib.rs +0 -380
- lastpngimageplugin-0.2.0/hatch_build.py +0 -93
- lastpngimageplugin-0.2.0/licenses/fdeflate-LICENSE-MIT +0 -25
- lastpngimageplugin-0.2.0/licenses/libdeflate-COPYING +0 -22
- lastpngimageplugin-0.2.0/pyproject.toml +0 -40
- lastpngimageplugin-0.2.0/rust/Cargo.lock +0 -128
- lastpngimageplugin-0.2.0/rust/Cargo.toml +0 -37
- lastpngimageplugin-0.2.0/rust/build.rs +0 -25
- lastpngimageplugin-0.2.0/rust/include/lastpng.h +0 -75
- lastpngimageplugin-0.2.0/rust/models/higher.f32le +0 -0
- lastpngimageplugin-0.2.0/rust/native/row_deflate.c +0 -235
- lastpngimageplugin-0.2.0/rust/src/deflate.rs +0 -184
- lastpngimageplugin-0.2.0/rust/src/encode.rs +0 -218
- lastpngimageplugin-0.2.0/rust/src/ffi.rs +0 -258
- lastpngimageplugin-0.2.0/rust/src/lib.rs +0 -1627
- lastpngimageplugin-0.2.0/rust/src/palette.rs +0 -292
- lastpngimageplugin-0.2.0/rust/src/row_deflate.rs +0 -144
- lastpngimageplugin-0.2.0/rust/src/row_model.rs +0 -771
- lastpngimageplugin-0.2.0/rust/src/tiny.rs +0 -167
- lastpngimageplugin-0.2.0/rust/src/ultrafast.rs +0 -222
- lastpngimageplugin-0.2.0/rust/vendor/fdeflate-LICENSE-MIT +0 -25
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/COPYING +0 -22
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/README.md +0 -9
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/common_defs.h +0 -735
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/adler32.c +0 -162
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/arm/adler32_impl.h +0 -365
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/arm/cpu_features.c +0 -292
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/arm/cpu_features.h +0 -214
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/arm/matchfinder_impl.h +0 -78
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/bt_matchfinder.h +0 -229
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/bt_matchfinder_search.h +0 -127
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/cpu_features_common.h +0 -93
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/deflate_compress.c +0 -4237
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/deflate_compress.h +0 -15
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/deflate_constants.h +0 -56
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/deflate_write_sequences.h +0 -67
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/hc_matchfinder.h +0 -401
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/ht_matchfinder.h +0 -263
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/lib_common.h +0 -106
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/matchfinder_common.h +0 -224
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/riscv/matchfinder_impl.h +0 -97
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/utils.c +0 -141
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/x86/adler32_impl.h +0 -136
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/x86/adler32_template.h +0 -518
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/x86/cpu_features.c +0 -213
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/x86/cpu_features.h +0 -170
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/x86/matchfinder_impl.h +0 -122
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/zlib_compress.c +0 -82
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/lib/zlib_constants.h +0 -21
- lastpngimageplugin-0.2.0/rust/vendor/libdeflate/libdeflate.h +0 -412
- lastpngimageplugin-0.2.0/src/LastPNGImagePlugin.py +0 -481
- lastpngimageplugin-0.2.0/tests/test_native_loading.py +0 -42
- lastpngimageplugin-0.2.0/tests/test_pillow_plugin.py +0 -951
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: LastPNGImagePlugin
|
|
3
|
+
Version: 999
|
|
4
|
+
Summary: LastPNGImagePlugin has been renamed to lastpng: https://pypi.org/project/lastpng/
|
|
5
|
+
Home-page: https://pypi.org/project/lastpng/
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Dynamic: description
|
|
8
|
+
Dynamic: description-content-type
|
|
9
|
+
Dynamic: home-page
|
|
10
|
+
Dynamic: summary
|
|
11
|
+
|
|
12
|
+
LastPNGImagePlugin has been renamed to [lastpng](https://pypi.org/project/lastpng/). Install it with `pip install lastpng`. The import remains `LastPNGImagePlugin`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: LastPNGImagePlugin
|
|
3
|
+
Version: 999
|
|
4
|
+
Summary: LastPNGImagePlugin has been renamed to lastpng: https://pypi.org/project/lastpng/
|
|
5
|
+
Home-page: https://pypi.org/project/lastpng/
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Dynamic: description
|
|
8
|
+
Dynamic: description-content-type
|
|
9
|
+
Dynamic: home-page
|
|
10
|
+
Dynamic: summary
|
|
11
|
+
|
|
12
|
+
LastPNGImagePlugin has been renamed to [lastpng](https://pypi.org/project/lastpng/). Install it with `pip install lastpng`. The import remains `LastPNGImagePlugin`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
LastPNGImagePlugin has been renamed to [lastpng](https://pypi.org/project/lastpng/). Install it with `pip install lastpng`. The import remains `LastPNGImagePlugin`.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from setuptools import setup
|
|
5
|
+
|
|
6
|
+
message = Path(__file__).with_name("README.md").read_text(encoding="utf-8").strip()
|
|
7
|
+
|
|
8
|
+
if sys.argv[1:] != ["sdist"]:
|
|
9
|
+
raise SystemExit(
|
|
10
|
+
"\nLastPNGImagePlugin has been renamed to lastpng:\n"
|
|
11
|
+
"https://pypi.org/project/lastpng/\n"
|
|
12
|
+
"\nInstall it with:\n"
|
|
13
|
+
" pip install lastpng\n"
|
|
14
|
+
"\nThe import remains LastPNGImagePlugin.\n"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
setup(
|
|
18
|
+
name="LastPNGImagePlugin",
|
|
19
|
+
version="999",
|
|
20
|
+
description="LastPNGImagePlugin has been renamed to lastpng: https://pypi.org/project/lastpng/",
|
|
21
|
+
long_description=message,
|
|
22
|
+
long_description_content_type="text/markdown",
|
|
23
|
+
url="https://pypi.org/project/lastpng/",
|
|
24
|
+
py_modules=[],
|
|
25
|
+
)
|
lastpngimageplugin-0.2.0/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Aleksandr Karpinskii
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.5
|
|
2
|
-
Name: LastPNGImagePlugin
|
|
3
|
-
Version: 0.2.0
|
|
4
|
-
Summary: A vibe-coded, blazingly fast PNG compressor for Pillow
|
|
5
|
-
License-Expression: MIT
|
|
6
|
-
License-File: LICENSE
|
|
7
|
-
License-File: licenses/fdeflate-LICENSE-MIT
|
|
8
|
-
License-File: licenses/libdeflate-COPYING
|
|
9
|
-
Requires-Python: >=3.10
|
|
10
|
-
Requires-Dist: cffi>=1.17
|
|
11
|
-
Requires-Dist: pillow<=13.0.0,>=11
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
|
|
14
|
-
# LastPNG for Pillow
|
|
15
|
-
|
|
16
|
-
LastPNG adds an alternative PNG encoder and decoder to Pillow: LastPNG compression
|
|
17
|
-
for saving images and the Rust `png` decoder for reading PNG and APNG files.
|
|
18
|
-
Use it through the usual Pillow API, either selecting LastPNG when saving or
|
|
19
|
-
registering it as the default PNG handler. Pillow continues to handle palettes,
|
|
20
|
-
metadata, and animation composition.
|
|
21
|
-
|
|
22
|
-
## Installation
|
|
23
|
-
|
|
24
|
-
Requires Python 3.10 or newer and Pillow 11 through 13.0.0. See the compatibility
|
|
25
|
-
details below for the Pillow versions supported by the native decoder.
|
|
26
|
-
|
|
27
|
-
```sh
|
|
28
|
-
pip install LastPNGImagePlugin
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Platform wheels include both native libraries and require no separate installation
|
|
32
|
-
of libdeflate or the Windows VC Redistributable.
|
|
33
|
-
|
|
34
|
-
## Usage
|
|
35
|
-
|
|
36
|
-
```python
|
|
37
|
-
from PIL import Image
|
|
38
|
-
import LastPNGImagePlugin
|
|
39
|
-
|
|
40
|
-
# Select LastPNG explicitly when saving.
|
|
41
|
-
with Image.open("input.png") as image:
|
|
42
|
-
image.save("output.png", format="LASTPNG", level=3)
|
|
43
|
-
|
|
44
|
-
# Use Rust decoding and LastPNG encoding by default throughout the process.
|
|
45
|
-
LastPNGImagePlugin.register_as_default()
|
|
46
|
-
with Image.open("input.png") as image:
|
|
47
|
-
image.save("output.png", level=3)
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
To enable only Rust decoding, use this initialization instead:
|
|
51
|
-
|
|
52
|
-
```python
|
|
53
|
-
import LastPNGImagePlugin
|
|
54
|
-
|
|
55
|
-
# Enable Rust decoding and keep the current PNG encoder.
|
|
56
|
-
LastPNGImagePlugin.register_as_default(encoder=False)
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Choose a compression level from 1 (fastest) to 6 (experimental, highest effort).
|
|
60
|
-
The default is 3.
|
|
61
|
-
|
|
62
|
-
### Save options
|
|
63
|
-
|
|
64
|
-
Use `pnginfo` for text and ancillary chunks, and the usual `icc_profile`,
|
|
65
|
-
`transparency`, `dpi`, and `exif` save options. When an ICC profile is supplied,
|
|
66
|
-
LastPNG preserves the input color family.
|
|
67
|
-
|
|
68
|
-
The plugin rejects IHDR, PLTE, tRNS, IDAT, IEND, bKGD, hIST, and sBIT in `pnginfo`,
|
|
69
|
-
since LastPNG selects the output representation. Raw `eXIf` and `iCCP` chunks in
|
|
70
|
-
`pnginfo` raise `ValueError`. Pass EXIF data with `exif=` and the uncompressed ICC
|
|
71
|
-
profile with `icc_profile=`.
|
|
72
|
-
|
|
73
|
-
To preserve a unitless pixel aspect ratio or exact pixels-per-metre values, pass a
|
|
74
|
-
single `pHYs` chunk in `pnginfo`. It is written before IDAT. Supplying both `pHYs`
|
|
75
|
-
and `dpi` raises `ValueError`.
|
|
76
|
-
|
|
77
|
-
HDR `mDCV` and `cLLI` chunks supplied through `pnginfo` are preserved before PLTE
|
|
78
|
-
and IDAT. Each is accepted once, with payload lengths of 24 and 8 bytes respectively.
|
|
79
|
-
An `mDCV` chunk requires an accompanying `cICP` chunk, in either input order.
|
|
80
|
-
|
|
81
|
-
## Limitations and behavior
|
|
82
|
-
|
|
83
|
-
### Formats and compatibility
|
|
84
|
-
|
|
85
|
-
The encoder saves single images in modes `1`, `L`, `I;16`, `P`, `RGB`, `LA`, and
|
|
86
|
-
`RGBA`. The decoder reads static PNGs, Adam7 interlaced images, and APNG frames.
|
|
87
|
-
|
|
88
|
-
On CPython, the plugin supports Pillow versions 11.0.0, 11.1.0, 11.2.1, 11.3.0,
|
|
89
|
-
12.0.0, 12.1.0, 12.1.1, 12.2.0, 12.3.0, and 13.0.0. Pillow ABIs outside this list
|
|
90
|
-
use Pillow's built-in decoder.
|
|
91
|
-
|
|
92
|
-
### Image access and animation
|
|
93
|
-
|
|
94
|
-
The plugin reads pixel rows directly, so keep the image unchanged until `save()`
|
|
95
|
-
returns. Serialize loading, seeking, and pixel access on the same image object.
|
|
96
|
-
|
|
97
|
-
APNG frames are decoded on demand without reading the whole animation into memory
|
|
98
|
-
or scanning ahead for IEND or EOF. Forward playback reads frame data once, including
|
|
99
|
-
gzip streams; large headers can be reread during decoder initialization. Rewinding
|
|
100
|
-
or retrying a native decode after an error rereads the stream. Keep the file open
|
|
101
|
-
while more frames are needed. Verification uses the original stream directly.
|
|
102
|
-
|
|
103
|
-
Pillow handles animation timing, seeking, blending, and disposal. Its compositor
|
|
104
|
-
limitations still apply, including unsupported `I;16` frame blending with `OP_OVER`.
|
|
105
|
-
If Pillow raises while processing metadata, transitioning between frames, or
|
|
106
|
-
composing a frame, subsequent loading and pixel access require reopening the image.
|
|
107
|
-
|
|
108
|
-
### Damaged PNGs
|
|
109
|
-
|
|
110
|
-
With `PIL.ImageFile.LOAD_TRUNCATED_IMAGES = True`, the Rust decoder accepts early
|
|
111
|
-
EOF, missing pixel rows and damaged compressed image data. It retains complete
|
|
112
|
-
decoded rows, including Adam7 pass rows. Unrecovered pixels retain their initial
|
|
113
|
-
contents: zeroes for new images, or the existing canvas for APNG frame rectangles.
|
|
114
|
-
CRC and Adler-32 validation are disabled in this mode. Pillow still parses the
|
|
115
|
-
headers, metadata, and APNG frame controls, including frame sequence validation.
|
|
116
|
-
|
|
117
|
-
Recovery can differ from Pillow's zlib decoder. The two decompressors can recover
|
|
118
|
-
different numbers of rows from an incomplete DEFLATE stream and can stop at
|
|
119
|
-
different positions after a corrupt byte. Consequently, the pixels recovered from
|
|
120
|
-
a damaged stream can differ. Rust's structural checks before image decoding and
|
|
121
|
-
its working-memory limits for static PNGs still apply and can reject inputs
|
|
122
|
-
accepted by Pillow. APNG decoding disables Rust png's internal allocation budget:
|
|
123
|
-
version 0.18.1 incorrectly charges it cumulatively across frames. Pillow still
|
|
124
|
-
controls the destination image allocation.
|
|
125
|
-
With truncated loading disabled, Rust reports corrupt static PNG IDAT checksums
|
|
126
|
-
and the plugin requires a readable chunk header after frame data; Pillow can
|
|
127
|
-
accept some of these files during `load()`. APNG fdAT CRC errors are accepted by
|
|
128
|
-
Rust png's default ancillary-chunk policy, as they are by Pillow's decoder.
|
|
129
|
-
|
|
130
|
-
## Building from source
|
|
131
|
-
|
|
132
|
-
A Rust toolchain and a C compiler are required. Run these commands from the
|
|
133
|
-
repository root.
|
|
134
|
-
|
|
135
|
-
To install directly from the checkout:
|
|
136
|
-
|
|
137
|
-
```sh
|
|
138
|
-
python -m pip install ./python
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
To build a source distribution and a wheel:
|
|
142
|
-
|
|
143
|
-
```sh
|
|
144
|
-
python -m pip install build
|
|
145
|
-
python -m build ./python
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
The packages are written to `python/dist/`.
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
# LastPNG for Pillow
|
|
2
|
-
|
|
3
|
-
LastPNG adds an alternative PNG encoder and decoder to Pillow: LastPNG compression
|
|
4
|
-
for saving images and the Rust `png` decoder for reading PNG and APNG files.
|
|
5
|
-
Use it through the usual Pillow API, either selecting LastPNG when saving or
|
|
6
|
-
registering it as the default PNG handler. Pillow continues to handle palettes,
|
|
7
|
-
metadata, and animation composition.
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
Requires Python 3.10 or newer and Pillow 11 through 13.0.0. See the compatibility
|
|
12
|
-
details below for the Pillow versions supported by the native decoder.
|
|
13
|
-
|
|
14
|
-
```sh
|
|
15
|
-
pip install LastPNGImagePlugin
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Platform wheels include both native libraries and require no separate installation
|
|
19
|
-
of libdeflate or the Windows VC Redistributable.
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
|
|
23
|
-
```python
|
|
24
|
-
from PIL import Image
|
|
25
|
-
import LastPNGImagePlugin
|
|
26
|
-
|
|
27
|
-
# Select LastPNG explicitly when saving.
|
|
28
|
-
with Image.open("input.png") as image:
|
|
29
|
-
image.save("output.png", format="LASTPNG", level=3)
|
|
30
|
-
|
|
31
|
-
# Use Rust decoding and LastPNG encoding by default throughout the process.
|
|
32
|
-
LastPNGImagePlugin.register_as_default()
|
|
33
|
-
with Image.open("input.png") as image:
|
|
34
|
-
image.save("output.png", level=3)
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
To enable only Rust decoding, use this initialization instead:
|
|
38
|
-
|
|
39
|
-
```python
|
|
40
|
-
import LastPNGImagePlugin
|
|
41
|
-
|
|
42
|
-
# Enable Rust decoding and keep the current PNG encoder.
|
|
43
|
-
LastPNGImagePlugin.register_as_default(encoder=False)
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Choose a compression level from 1 (fastest) to 6 (experimental, highest effort).
|
|
47
|
-
The default is 3.
|
|
48
|
-
|
|
49
|
-
### Save options
|
|
50
|
-
|
|
51
|
-
Use `pnginfo` for text and ancillary chunks, and the usual `icc_profile`,
|
|
52
|
-
`transparency`, `dpi`, and `exif` save options. When an ICC profile is supplied,
|
|
53
|
-
LastPNG preserves the input color family.
|
|
54
|
-
|
|
55
|
-
The plugin rejects IHDR, PLTE, tRNS, IDAT, IEND, bKGD, hIST, and sBIT in `pnginfo`,
|
|
56
|
-
since LastPNG selects the output representation. Raw `eXIf` and `iCCP` chunks in
|
|
57
|
-
`pnginfo` raise `ValueError`. Pass EXIF data with `exif=` and the uncompressed ICC
|
|
58
|
-
profile with `icc_profile=`.
|
|
59
|
-
|
|
60
|
-
To preserve a unitless pixel aspect ratio or exact pixels-per-metre values, pass a
|
|
61
|
-
single `pHYs` chunk in `pnginfo`. It is written before IDAT. Supplying both `pHYs`
|
|
62
|
-
and `dpi` raises `ValueError`.
|
|
63
|
-
|
|
64
|
-
HDR `mDCV` and `cLLI` chunks supplied through `pnginfo` are preserved before PLTE
|
|
65
|
-
and IDAT. Each is accepted once, with payload lengths of 24 and 8 bytes respectively.
|
|
66
|
-
An `mDCV` chunk requires an accompanying `cICP` chunk, in either input order.
|
|
67
|
-
|
|
68
|
-
## Limitations and behavior
|
|
69
|
-
|
|
70
|
-
### Formats and compatibility
|
|
71
|
-
|
|
72
|
-
The encoder saves single images in modes `1`, `L`, `I;16`, `P`, `RGB`, `LA`, and
|
|
73
|
-
`RGBA`. The decoder reads static PNGs, Adam7 interlaced images, and APNG frames.
|
|
74
|
-
|
|
75
|
-
On CPython, the plugin supports Pillow versions 11.0.0, 11.1.0, 11.2.1, 11.3.0,
|
|
76
|
-
12.0.0, 12.1.0, 12.1.1, 12.2.0, 12.3.0, and 13.0.0. Pillow ABIs outside this list
|
|
77
|
-
use Pillow's built-in decoder.
|
|
78
|
-
|
|
79
|
-
### Image access and animation
|
|
80
|
-
|
|
81
|
-
The plugin reads pixel rows directly, so keep the image unchanged until `save()`
|
|
82
|
-
returns. Serialize loading, seeking, and pixel access on the same image object.
|
|
83
|
-
|
|
84
|
-
APNG frames are decoded on demand without reading the whole animation into memory
|
|
85
|
-
or scanning ahead for IEND or EOF. Forward playback reads frame data once, including
|
|
86
|
-
gzip streams; large headers can be reread during decoder initialization. Rewinding
|
|
87
|
-
or retrying a native decode after an error rereads the stream. Keep the file open
|
|
88
|
-
while more frames are needed. Verification uses the original stream directly.
|
|
89
|
-
|
|
90
|
-
Pillow handles animation timing, seeking, blending, and disposal. Its compositor
|
|
91
|
-
limitations still apply, including unsupported `I;16` frame blending with `OP_OVER`.
|
|
92
|
-
If Pillow raises while processing metadata, transitioning between frames, or
|
|
93
|
-
composing a frame, subsequent loading and pixel access require reopening the image.
|
|
94
|
-
|
|
95
|
-
### Damaged PNGs
|
|
96
|
-
|
|
97
|
-
With `PIL.ImageFile.LOAD_TRUNCATED_IMAGES = True`, the Rust decoder accepts early
|
|
98
|
-
EOF, missing pixel rows and damaged compressed image data. It retains complete
|
|
99
|
-
decoded rows, including Adam7 pass rows. Unrecovered pixels retain their initial
|
|
100
|
-
contents: zeroes for new images, or the existing canvas for APNG frame rectangles.
|
|
101
|
-
CRC and Adler-32 validation are disabled in this mode. Pillow still parses the
|
|
102
|
-
headers, metadata, and APNG frame controls, including frame sequence validation.
|
|
103
|
-
|
|
104
|
-
Recovery can differ from Pillow's zlib decoder. The two decompressors can recover
|
|
105
|
-
different numbers of rows from an incomplete DEFLATE stream and can stop at
|
|
106
|
-
different positions after a corrupt byte. Consequently, the pixels recovered from
|
|
107
|
-
a damaged stream can differ. Rust's structural checks before image decoding and
|
|
108
|
-
its working-memory limits for static PNGs still apply and can reject inputs
|
|
109
|
-
accepted by Pillow. APNG decoding disables Rust png's internal allocation budget:
|
|
110
|
-
version 0.18.1 incorrectly charges it cumulatively across frames. Pillow still
|
|
111
|
-
controls the destination image allocation.
|
|
112
|
-
With truncated loading disabled, Rust reports corrupt static PNG IDAT checksums
|
|
113
|
-
and the plugin requires a readable chunk header after frame data; Pillow can
|
|
114
|
-
accept some of these files during `load()`. APNG fdAT CRC errors are accepted by
|
|
115
|
-
Rust png's default ancillary-chunk policy, as they are by Pillow's decoder.
|
|
116
|
-
|
|
117
|
-
## Building from source
|
|
118
|
-
|
|
119
|
-
A Rust toolchain and a C compiler are required. Run these commands from the
|
|
120
|
-
repository root.
|
|
121
|
-
|
|
122
|
-
To install directly from the checkout:
|
|
123
|
-
|
|
124
|
-
```sh
|
|
125
|
-
python -m pip install ./python
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
To build a source distribution and a wheel:
|
|
129
|
-
|
|
130
|
-
```sh
|
|
131
|
-
python -m pip install build
|
|
132
|
-
python -m build ./python
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
The packages are written to `python/dist/`.
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
# This file is automatically @generated by Cargo.
|
|
2
|
-
# It is not intended for manual editing.
|
|
3
|
-
version = 4
|
|
4
|
-
|
|
5
|
-
[[package]]
|
|
6
|
-
name = "adler2"
|
|
7
|
-
version = "2.0.1"
|
|
8
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
-
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
|
10
|
-
|
|
11
|
-
[[package]]
|
|
12
|
-
name = "bitflags"
|
|
13
|
-
version = "2.13.2"
|
|
14
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
-
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
|
16
|
-
|
|
17
|
-
[[package]]
|
|
18
|
-
name = "cfg-if"
|
|
19
|
-
version = "1.0.5"
|
|
20
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
-
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
|
22
|
-
|
|
23
|
-
[[package]]
|
|
24
|
-
name = "crc32fast"
|
|
25
|
-
version = "1.5.6"
|
|
26
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
-
checksum = "fd9ae8fcb3ea71b0b26338b4ffb13006bb175de8fd07921089a906ce7e5e6945"
|
|
28
|
-
dependencies = [
|
|
29
|
-
"cfg-if",
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
[[package]]
|
|
33
|
-
name = "fdeflate"
|
|
34
|
-
version = "0.3.7"
|
|
35
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
36
|
-
checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
|
|
37
|
-
dependencies = [
|
|
38
|
-
"simd-adler32",
|
|
39
|
-
]
|
|
40
|
-
|
|
41
|
-
[[package]]
|
|
42
|
-
name = "flate2"
|
|
43
|
-
version = "1.1.11"
|
|
44
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
45
|
-
checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4"
|
|
46
|
-
dependencies = [
|
|
47
|
-
"crc32fast",
|
|
48
|
-
"miniz_oxide 0.9.1",
|
|
49
|
-
"zlib-rs",
|
|
50
|
-
]
|
|
51
|
-
|
|
52
|
-
[[package]]
|
|
53
|
-
name = "lastpng_decoder"
|
|
54
|
-
version = "0.1.0"
|
|
55
|
-
dependencies = [
|
|
56
|
-
"png",
|
|
57
|
-
]
|
|
58
|
-
|
|
59
|
-
[[package]]
|
|
60
|
-
name = "miniz_oxide"
|
|
61
|
-
version = "0.8.9"
|
|
62
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
63
|
-
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
|
64
|
-
dependencies = [
|
|
65
|
-
"adler2",
|
|
66
|
-
"simd-adler32",
|
|
67
|
-
]
|
|
68
|
-
|
|
69
|
-
[[package]]
|
|
70
|
-
name = "miniz_oxide"
|
|
71
|
-
version = "0.9.1"
|
|
72
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
73
|
-
checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"
|
|
74
|
-
dependencies = [
|
|
75
|
-
"adler2",
|
|
76
|
-
"simd-adler32",
|
|
77
|
-
]
|
|
78
|
-
|
|
79
|
-
[[package]]
|
|
80
|
-
name = "png"
|
|
81
|
-
version = "0.18.1"
|
|
82
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
83
|
-
checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"
|
|
84
|
-
dependencies = [
|
|
85
|
-
"bitflags",
|
|
86
|
-
"crc32fast",
|
|
87
|
-
"fdeflate",
|
|
88
|
-
"flate2",
|
|
89
|
-
"miniz_oxide 0.8.9",
|
|
90
|
-
]
|
|
91
|
-
|
|
92
|
-
[[package]]
|
|
93
|
-
name = "simd-adler32"
|
|
94
|
-
version = "0.3.10"
|
|
95
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
96
|
-
checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
|
|
97
|
-
|
|
98
|
-
[[package]]
|
|
99
|
-
name = "zlib-rs"
|
|
100
|
-
version = "0.6.9"
|
|
101
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
102
|
-
checksum = "aa76918995d776d9dd34d371030be228d021137449771493d56e29f77e4148ac"
|