WebP libraries for Python
- Pillow is the default choice. Its wheels bundle libwebp, so lossy, lossless and animated WebP, ICC profiles, Exif and XMP work after
pip install pillow. - OpenCV reads and writes still WebP images as NumPy arrays. Pick it when the image goes into a computer vision pipeline.
pyvips (libvips) and Wand (ImageMagick) also handle WebP through the same native libraries the Ruby and PHP pages describe.
- OpenCV OpenCV reads and writes WebP images as NumPy arrays in Python. How to install opencv-python, convert images to WebP, set WebP quality, write lossless WebP.
- Pillow Pillow reads and writes WebP in Python, including lossless and animated WebP. How to convert JPEG or PNG to WebP, set quality and method.