openslide-python
Python interface to OpenSlide
What it is and what it does
OpenSlide Python wraps the OpenSlide C library to read whole-slide images—the massive, multi-resolution medical images used in digital pathology. These images can occupy tens of gigabytes uncompressed and come in proprietary formats from vendors like Aperio, Hamamatsu, Leica, Philips, Zeiss, and others; standard image tools cannot handle them. The library lets you read image data at the resolution closest to a desired zoom level without loading the entire file into RAM.
The package depends on Pillow for image handling and requires Python ≥3.10 and a separate OpenSlide C library installation (≥3.4.0). It supports formats including Aperio, ARGOS, DICOM, Hamamatsu, Huron, Leica, MIRAX, Philips, Sakura, Trestle, Ventana, Zeiss, and generic tiled TIFF, and is actively maintained with wheels for modern Python versions and multiple architectures.
Use it for:
- Load and tile whole-slide images for web-based pathology viewers or deep-learning training pipelines
- Extract regions of interest at specific zoom levels from gigabyte-scale slides in vendor formats
- Build automated image analysis workflows that process whole-slide images without memory exhaustion
- Integrate multi-resolution slide access into clinical decision-support or research annotation tools
- Work with DICOM or CZI slides in medical imaging applications
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
OpenSlide Python provides a Python interface to read whole-slide images (virtual slides) used in digital pathology, supporting multiple vendor formats and efficient multi-resolution access to gigabyte-scale images.
Yes, if you work with whole-slide images in digital pathology or medical research. The package is actively maintained, well-supported across platforms and Python versions, and solves a specialized but critical problem—standard image libraries cannot handle these formats or their scale. The main gotcha is the separate OpenSlide C library dependency. No known vulnerabilities.
Install
openslide-python on PyPI
pip
pip install openslide-pythonuv
uv add openslide-pythonpoetry
poetry add openslide-pythonInstalling openslide-python
Before you install
Medium install friction due to a compiled C dependency (OpenSlide library) that must be installed separately. The project is actively maintained with recent releases, and wheels are provided for multiple Python versions and platforms (macOS, Linux, Windows, including aarch64).
License in practice
Licensed under LGPL-2.1-only with additional BSD-3-Clause, MIT, and public domain components. The copyleft LGPL treatment means derivative works must be licensed compatibly, though linking from a proprietary application is generally permitted if OpenSlide is dynamically linked.
Quickstart
pip install openslide-python
from openslide import OpenSlide
slide = OpenSlide('path/to/slide.svs')
region = slide.read_region((x, y), level, (width, height))
OpenSlide C library (≥3.4.0) must be installed separately; installation method varies by platform.
Verify before relying
- Whether the OpenSlide C library (≥3.4.0) is pre-installed on target systems or must be managed separately in deployment
- Performance characteristics and memory efficiency when handling specific gigabyte-scale slide formats in production
- Recommended installation method for the separate OpenSlide C library dependency on different platforms
Package facts
| License | LGPL-2.1-only AND BSD-3-Clause AND MIT AND LicenseRef-Public-Domain (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — Pillow |
| Maintenance | actively maintained — 67 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 270,441/month — #8,236 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: openslide_python-1.4.6-cp310-cp310-macosx_10_9_universal2.whl; openslide_python-1.4.6-cp310-cp310-manylinux1_x86_64.manylinux_2_5_x86_64.whl; openslide_python-1.4.6-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; openslide_python-1.4.6-cp310-cp310-win_amd64.whl; openslide_python-1.4.6-cp311-abi3-macosx_10_9_universal2.whl; openslide_python-1.4.6-cp311-abi3-manylinux1_x86_64.manylinux_2_5_x86_64.whl; openslide_python-1.4.6-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; openslide_python-1.4.6-cp311-abi3-win_amd64.whl; openslide_python-1.4.6-cp313-cp313t-macosx_10_13_universal2.whl; openslide_python-1.4.6-cp313-cp313t-manylinux1_x86_64.manylinux_2_5_x86_64.whl; openslide_python-1.4.6-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; openslide_python-1.4.6-cp313-cp313t-win_amd64.whl; openslide_python-1.4.6-cp314-cp314t-macosx_10_15_universal2.whl; openslide_python-1.4.6-cp314-cp314t-manylinux1_x86_64.manylinux_2_5_x86_64.whl; openslide_python-1.4.6-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; openslide_python-1.4.6-cp314-cp314t-win_amd64.whl
Keywords: OpenSlide, whole-slide image, virtual slide, library
Tags
More Bio-Informatics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
biopythonBiopython provides Python tools for…
unclear · top 5,000 on PyPI
firecrawl-pyClient library for the Firecrawl API that…
permissive · top 5,000 on PyPI
intervaltreeA self-balancing interval tree data structure…
permissive · top 5,000 on PyPI
albumentationsAlbumentations applies image transformations to…
permissive · top 5,000 on PyPI
PubChemPyPubChemPy is a Python wrapper around the…
permissive · top 5,000 on PyPI
openslide-binProvides prebuilt OpenSlide binaries for Linux,…
copyleft · top 15,000 on PyPI
large-imageLarge Image provides Python methods to…
permissive · top 15,000 on PyPI
dicomweb-clientA Python client library for interacting with…
permissive · top 15,000 on PyPI
tifffileRead and write TIFF files and TIFF-like formats…
permissive · top 1,000 on PyPI
highdicomHighdicom provides a high-level Python API for…
permissive · top 15,000 on PyPI
OpenImageIOOpenImageIO reads, writes, and processes images…
permissive · top 15,000 on PyPI
python-gdcmPython wrapper for GDCM (Grassroots DICOM), a…
permissive · top 15,000 on PyPI
aspose-slidesAspose.Slides generates, modifies, converts,…
unclear · top 15,000 on PyPI
ExifReadExtracts Exif metadata from digital image files…
unclear · top 5,000 on PyPI
PIMSPIMS provides a unified interface to read…
permissive · top 15,000 on PyPI