Skip to main content

A PyQt6 QWidget for image viewing, annotation, and shape editing.

Project description

fry-qt6-image-widget

fry-qt6-image-widget is a PyQt6 image viewing and annotation widget. The core class is FryCanvas, and it inherits from QtWidgets.QWidget, so it can be placed directly into a layout, a QMainWindow, a QScrollArea, or wrapped by the application as a QDockWidget when needed.

The package intentionally exposes a widget, not a dock. Dock behavior belongs to the host application.

Install

pip install fry-qt6-image-widget

For local development:

python -m pip install -e ".[dev]"
python -m pytest

Quick Start

import sys

import numpy as np
from PyQt6 import QtWidgets
from fry_qt6_image_widget import FryCanvas


app = QtWidgets.QApplication(sys.argv)

canvas = FryCanvas()
canvas.resize(900, 600)
canvas.setViewMode()

image = np.ones((480, 640, 3), dtype=np.uint8) * 255
canvas.show_image_np(image, description="white demo image")

canvas.show()
sys.exit(app.exec())

Common Imports

from fry_qt6_image_widget import (
    FryCanvas,
    FryCanvasMode,
    create_shape,
)

Backward-compatible imports are also available:

from fry_base_classes import FryCanvas

Typical Operations

canvas = FryCanvas()

canvas.show_image("demo.png")
canvas.show_image_np(image_np)
image_np = canvas.get_image_np()

canvas.set_canvas_mode("view")
canvas.set_canvas_mode("draw")
canvas.set_shape_type("rectangle")

shape = create_shape("rectangle", label="box")
canvas.append_shape(shape)
all_shapes = canvas.get_all_shapes_data()

Supported shape type strings include polygon, rectangle, circle, line, linestrip, point, points, mask, and brush.

Examples

Core Notes

The key concepts and integration notes are documented in docs/CORE_CONCEPTS.md.

Build a pip Package

python -m pip install build twine
python -m build
python -m twine check dist/*

This produces a source distribution and a wheel in dist/. To publish to PyPI, run:

python -m twine upload dist/*

Publishing needs a PyPI account and token, so the repository is prepared for upload but credentials are not stored in the project.

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

fry_qt6_image_widget-0.2.0.tar.gz (125.5 kB view details)

Uploaded Source

Built Distribution

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

fry_qt6_image_widget-0.2.0-py3-none-any.whl (170.1 kB view details)

Uploaded Python 3

File details

Details for the file fry_qt6_image_widget-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for fry_qt6_image_widget-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fe567c22af7994a12a6ab694c1334d42a192d6ed1a4379101673ab3eda680ae8
MD5 98b26118b8bb0934bf86d9bfd6489e6d
BLAKE2b-256 cf0a4cd0d83a5c0f76a6a59c5ff13a1d7d66774613f8bb0f62403507c8479880

See more details on using hashes here.

File details

Details for the file fry_qt6_image_widget-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fry_qt6_image_widget-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f9daa6d44fdd2701fcb5715d9ce432d896d74b5eabdffed85a2b6d2d0454d45
MD5 43c4f44aec82bb6ca3027407c8abf54f
BLAKE2b-256 3615490bca22cb47c2e70d89e580af476e9e066a60ae96d4f582d202d5e40c33

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