Skip to main content

maskstudio

PyPI version Python versions License

MaskStudio is a vector-first desktop mask annotation studio for batch image workflows. It opens a folder or a single image, keeps editable annotations as Shapely geometry in image coordinates, and saves deterministic grayscale PNG masks beside the source images.

Supported operations

  • Open a folder or single image (non-interactive path resolution)
  • Paint, polygon, rectangle, and hole tools with edge-aware refinement
  • Contour edit mode with vertex and edge handles
  • Overview plus detail split view with adjustable ROI
  • Undo/redo history per document
  • Deterministic <stem>_mask.png output (mode L, black mask on white)

Requirements

  • Python 3.12 or newer
  • Dependencies installed automatically by pip: numpy, opencv-python, Pillow, pydantic, PySide6, shapely
  • On Linux, a working X11 or Wayland session is required for the Qt runtime

Install

pip install maskstudio

Checking the version

import maskstudio

print(maskstudio.__version__)

Configuration

MaskStudio does not require credentials or environment variables. Inputs are passed either to the Python API or to the installed CLI launcher.

import maskstudio

result = maskstudio.annotate_masks()
result = maskstudio.annotate_masks("/path/to/folder")
result = maskstudio.annotate_masks("/path/to/image.png")
maskstudio
maskstudio /path/to/folder
maskstudio /path/to/image.png

See docs/configuration.md for the detailed input resolution flow and supported raster formats.

Quickstart

Annotate every image in a folder

import maskstudio

result = maskstudio.annotate_masks("/path/to/folder")
for saved_mask in result:
    print(saved_mask)

Annotate a single image

import maskstudio

result = maskstudio.annotate_masks("/path/to/image.png")
print(f"Saved {len(result)} mask(s)")

Open the graphical folder picker

import maskstudio

result = maskstudio.annotate_masks()
if not result.saved_paths:
    print("Session finished with no saved masks")

Use the installed CLI launcher

maskstudio /path/to/folder

Public API

Module Symbol Description
maskstudio annotate_masks(path=None) Launch the GUI and return an AnnotationResult.
maskstudio __version__ Installed package version string.
maskstudio.models AnnotationRequest Frozen Pydantic request with optional path.
maskstudio.models AnnotationResult Frozen Pydantic result with saved_paths.
maskstudio.exceptions MaskStudioError Base class for every typed exception.
maskstudio.exceptions NoImagesFoundError Raised when a folder has no supported images.
maskstudio.exceptions UnsupportedImageError Raised when a file is not a supported image.

Supported input formats

The discovery layer accepts these raster formats case-insensitively: .png, .jpg, .jpeg, .bmp, .tif, .tiff, .webp. Files whose name already matches *_mask.png are skipped during folder scanning.

Saved output rules

  • Output path is always <original_stem>_mask.png in the source directory.
  • Saved masks are always PNG, mode L.
  • Background pixels are white (255); annotated pixels are black (0).
  • Saved files never contain alpha, outlines, or display-only styling.

Error handling

import maskstudio
from maskstudio.exceptions import MaskStudioError, NoImagesFoundError

try:
    result = maskstudio.annotate_masks("/path/to/folder")
except NoImagesFoundError as error:
    print(f"No images in {error.path}")
except MaskStudioError as error:
    print(f"MaskStudio failed: {error}")

See docs/errors.md for the full exception hierarchy.

Additional docs

Contributing

See CONTRIBUTING.md for the development setup, test commands, and the full build and publish workflow.

Metadata

Release files for maskstudio 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maskstudio 0.1.1
File Size Uploaded Provenance Actions
maskstudio-0.1.1.tar.gz 48.2 kB Without provenance Details for maskstudio-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for maskstudio 0.1.1
File Interpreter ABI Platform Actions
maskstudio-0.1.1-py3-none-any.whl Python 3 none any Details for maskstudio-0.1.1-py3-none-any.whl

Total release size: 100.3 kB

Release files / maskstudio-0.1.1.tar.gz

Download URL maskstudio-0.1.1.tar.gz
Size 48.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1e905e5ed82b104f796fa38bd0292eb3a16945b5ca927e2251a966ee3fe244b6
BLAKE2b-256 checksum
How to use checksums
6d78f727d81beb69d039868134dea12c67dc3e65f704379010974bfc5a2da061
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / maskstudio-0.1.1-py3-none-any.whl

Download URL maskstudio-0.1.1-py3-none-any.whl
Size 52.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bc525ab55fd8425b7f80c2d1f463fefdec9569387d57bf61fb60a4b3299244c
BLAKE2b-256 checksum
How to use checksums
97d803bdf2235b1fe58a934a6c864c51bf6c334e7453bdd319286df0b0042526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Security for maskstudio 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page