Skip to main content

Vector-first desktop mask annotation studio for batch image workflows.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maskstudio-0.1.1.tar.gz (48.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

maskstudio-0.1.1-py3-none-any.whl (52.1 kB view details)

Uploaded Python 3

File details

Details for the file maskstudio-0.1.1.tar.gz.

File metadata

  • Download URL: maskstudio-0.1.1.tar.gz
  • Upload date:
  • Size: 48.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for maskstudio-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1e905e5ed82b104f796fa38bd0292eb3a16945b5ca927e2251a966ee3fe244b6
MD5 c1b94847e6dd35eb60ae023c4b0167e1
BLAKE2b-256 6d78f727d81beb69d039868134dea12c67dc3e65f704379010974bfc5a2da061

See more details on using hashes here.

File details

Details for the file maskstudio-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: maskstudio-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 52.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for maskstudio-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0bc525ab55fd8425b7f80c2d1f463fefdec9569387d57bf61fb60a4b3299244c
MD5 ba317597e2ea5da5b088a47bfcba9740
BLAKE2b-256 97d803bdf2235b1fe58a934a6c864c51bf6c334e7453bdd319286df0b0042526

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page