PyMatting
Python package for alpha matting.
Decision gist · record as of 2026-08-14
Yes. PyMatting is actively maintained, has no known vulnerabilities, installs with low friction, and is licensed permissively. Install it if you need to solve alpha matting problems or extract foreground objects from images with trimap guidance. Skip it if you require deep learning–based matting or have no use for trimap-driven segmentation.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- First import takes a minute due to compilation.
- GPU support requires separate driver installation and optional dependencies.
- Low friction: pure Python wheel with four well-established numeric dependencies (numpy, pillow, numba, scipy).
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute PyMatting with minimal restrictions, provided you include the license notice.
last release 2026-01-26 (200 days) · last repo commit 2026-04-07 · 1,914 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,205,995 downloads/mo, #2,702 on PyPI
Alternatives
Verify before relying
pip install pymatting
from pymatting import cutout
cutout(
"input_image.png",
"input_trimap.png",
"output_cutout.png"
)- Performance characteristics and typical runtime for different image sizes and matting methods
- Memory requirements for large-scale batch processing
- Accuracy comparison with other alpha matting approaches
What it is and what it does
PyMatting is a Python library implementing six different alpha matting algorithms to estimate the alpha channel (transparency) of foreground objects in images. Given an input image and a trimap (a rough manual segmentation into foreground, background, and unknown regions), it computes pixel-level alpha values that allow clean foreground extraction and compositing onto new backgrounds. The library also provides foreground estimation with optional GPU acceleration via CuPy or PyOpenCL.
The package is built on numpy, scipy, and numba for numerical computation and includes specialized tools like fast multithreaded KNN search and preconditioners (incomplete Cholesky decomposition, V-Cycle multigrid) to accelerate convergence. It is designed for readable, maintainable code and includes test coverage of 89%. GPU support is optional and requires separate driver setup.
Use it for
- Removing or replacing image backgrounds in photo editing workflows by extracting precise alpha channels
- Preparing foreground objects for compositing onto different backgrounds in graphics or video production
- Batch processing images to generate clean cutouts for e-commerce or product photography
- Integrating alpha matting into image segmentation pipelines alongside other computer vision tasks
- Accelerating foreground estimation on GPU-equipped systems for high-throughput applications
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
PyMatting is actively maintained, has no known vulnerabilities, installs with low friction, and is licensed permissively. Install it if you need to solve alpha matting problems or extract foreground objects from images with trimap guidance. Skip it if you require deep learning–based matting or have no use for trimap-driven segmentation.
Install
pymatting on PyPI
Before you install
Low friction: pure Python wheel with four well-established numeric dependencies (numpy, pillow, numba, scipy). Repository is active with recent commits and 1914 stars. Last release was 200 days ago.
First import takes a minute due to compilation. GPU support requires separate driver installation and optional dependencies.
License in practice
MIT license is permissive; you can use, modify, and distribute PyMatting with minimal restrictions, provided you include the license notice.
Quickstart
pip install pymatting
from pymatting import cutout
cutout(
"input_image.png",
"input_trimap.png",
"output_cutout.png"
)
Verify before relying
- Performance characteristics and typical runtime for different image sizes and matting methods
- Memory requirements for large-scale batch processing
- Accuracy comparison with other alpha matting approaches
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 4 packagesnumpypillownumbascipy |
| Maintenance | Actively maintained 200 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,205,995 / month, #2,702 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 |
Evidence: pymatting-1.1.15-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “alpha matting image segmentation”
- PyMattingPyMatting solves the alpha matting problem—extracting foreground…
- facexlibFacexlib provides a collection of PyTorch-based face analysis…
- modelscopeModelScope provides unified Python interfaces for inference,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also transparent-background · facexlib · rembg · mmdet · pycuda · fill-voids · blendmodes · albumentations · cupy-cuda13x · blend-modes