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.1.0.tar.gz (126.1 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.1.0-py3-none-any.whl (169.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fry_qt6_image_widget-0.1.0.tar.gz
  • Upload date:
  • Size: 126.1 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.1.0.tar.gz
Algorithm Hash digest
SHA256 c828c28239b48763a43b71dbdf053b3f8fc29448b45d4fdff3b052cd3937c671
MD5 38db44f98cd63423dfb2392e00f556ff
BLAKE2b-256 afbe0f91355ddcd93be1f2ed67e681c12accd4fb6784c9464cb779767dc616e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fry_qt6_image_widget-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1ac08bd2f9199120789390ea18acfd6c4a49495449a1d1e66afaa8b65b02fec
MD5 62113d1667ea893f0ba4f2bce196b75b
BLAKE2b-256 cd043fcba05af4317ab66ce1bfa4f976d1877e702f8965aaacaeb4f60818d901

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