LastPNG for Pillow
Save PNG images from Pillow with LastPNG. Install with pip install LastPNGImagePlugin,
then import the plugin to register the LASTPNG format.
from PIL import Image
import LastPNGImagePlugin
with Image.open("input.png") as image:
image.save("output.png", format="LASTPNG", level=3)
Choose a compression level from 1 (fastest) to 6 (experimental, highest effort).
The default is 3. The plugin supports single images in modes 1, L, I;16,
P, RGB, LA, and RGBA. Platform wheels bundle the encoder. Building
from source requires a Rust toolchain and a C compiler.
Supported Pillow versions and save options