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.0.tar.gz (48.0 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.0-py3-none-any.whl (52.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for maskstudio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c6fe97eb93c16bcca94ef86ac46f78d970fd3255c502605e410c050e40dcfe04
MD5 06941b2ffe5b9a77d63993bd8488679a
BLAKE2b-256 7343723f813c758b2e2b13623c3dff2e7879c61c4b549f52242f190508fa09a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: maskstudio-0.1.0-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.12.13

File hashes

Hashes for maskstudio-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76427f452cbc9aa355a44d152897fd4adf820c8cc7b7b34d10d06dd33d7b0e9e
MD5 1c64503ab9a45f6d40f2f13e9a3cb014
BLAKE2b-256 b5f779d9de23dafdb113a178d113802f961a3d6b85fefc6f679f1ed73781230b

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