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.1.tar.gz (125.9 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.1-py3-none-any.whl (170.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fry_qt6_image_widget-0.2.1.tar.gz
  • Upload date:
  • Size: 125.9 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.1.tar.gz
Algorithm Hash digest
SHA256 b400b46b97df19205462f63e6f759ad371dcf3d1464471f2fc4351bd5914cd00
MD5 dbb31b18d1e94c9854e5cacf0f319b75
BLAKE2b-256 001a325a504e0ab85bee478dff03891d3acf04f97b4277cd038b45fc25935712

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fry_qt6_image_widget-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2430a3dbf216ff9c308a2ef21028852e711a8885278a2eb9e377dce65b8af04
MD5 325ff3ece2221db2fb4beba8f427c25e
BLAKE2b-256 355733cbdd8a70c2d8d08249c090dd69321680787ce24f4579508a5f1e306a60

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