Common Image Tools
Description
common_image_tools is a repository containing a curated collection of commonly used image manipulation functions for computer vision projects. These tools provide a set of handy functions for performing various image processing tasks, such as resizing, cropping, filtering, and more.
Features
- Resizing: Easily resize images to desired dimensions.
- Cropping: Crop images to focus on specific regions.
- Filtering: Apply various filters to enhance or modify images.
- Conversion: Convert images between different formats.
- Visualization: Tools for visualizing image data.
- Video Source: Flexible interface for handling different types of video inputs.
Installation
To install common_image_tools, run the following command:
pip install common-image-tools
or using uv:
uv add common-image-tools
Usage
Video Source
The VideoSource class provides a flexible interface for handling different types of video inputs with support for various OpenCV backends and hardware acceleration on Jetson devices.
Features
- Support for multiple video source types:
- RTSP streams
- Video files (MP4)
- Webcam devices
- Configurable frame dimensions and FPS
- Multiple backend options:
- OpenCV default
- GStreamer
- GStreamer with Jetson hardware acceleration
- Automatic backend selection based on system capabilities
Basic Usage
from common_image_tools import VideoSource
import cv2
# Create a video source
source = VideoSource(
"video.mp4",
target_frame_height=720,
target_frame_width=1280,
target_fps=30
)
# Use with OpenCV
cap = cv2.VideoCapture(source.parsed_source)
Different Source Types
# RTSP Stream
rtsp_source = VideoSource("rtsp://example.com/stream")
# Video File
file_source = VideoSource("path/to/video.mp4")
# Webcam
webcam_source = VideoSource("/dev/video0")
# Webcam
webcam_source = VideoSource(0)
Backend Selection
from common_image_tools import VideoSource, OpencvBackendMode
# Auto backend selection (default)
source = VideoSource("video.mp4")
# Force OpenCV default backend
source = VideoSource(
"video.mp4",
opencv_backend=OpencvBackendMode.OPENCV_DEFAULT
)
# Force GStreamer backend
source = VideoSource(
"video.mp4",
opencv_backend=OpencvBackendMode.OPENCV_GSTREAMER
)
# Use Jetson-optimized GStreamer backend
source = VideoSource(
"video.mp4",
opencv_backend=OpencvBackendMode.OPENCV_GSTREAMER_JETSON
)
API Reference
VideoSource
VideoSource(
source,
target_frame_height: int = None,
target_frame_width: int = None,
target_fps: int = None,
opencv_backend: OpencvBackendMode = OpencvBackendMode.AUTO
)
Conversion
Operation
Tool
Pixelation (privacy mosaic)
pixelate_person mosaics a person in place, from their keypoints and/or box. The cell size comes
from the whole image (64 cells across its long side by default), so a small or distant person is
censored as hard as a close one, while the silhouette stays readable:
from common_image_tools.tool import pixelate_person
for pose in poses:
# keypoints as {"x", "y", "score"} dicts or (x, y[, score]) rows, bbox as (x, y, w, h),
# both normalized 0-1 (normalized=False for pixels)
pixelate_person(frame, pose.keypoints, pose.bbox)
The building blocks are public too, for other shapes: bbox_from_points builds the padded box
around a set of pixel points, and pixelate_area mosaics any (x0, y0, x1, y1) area.
Verification
Visualization
Contributing
Contributions are welcome! If you have any suggestions, improvements, or new features to add, please open an issue or submit a pull request. Make sure to follow the existing coding style and include appropriate tests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for common-image-tools 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| common_image_tools-1.1.0.tar.gz | 63.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| common_image_tools-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 78.7 kB
Release files / common_image_tools-1.1.0.tar.gz
| Download URL | common_image_tools-1.1.0.tar.gz |
|---|---|
| Size | 63.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
370b150b7f77218f7dc67375a26385d72149d33ab3403b9a43257de6928af530
|
|
BLAKE2b-256 checksum How to use checksums |
74295b2dea98f68cdf9884dc4b6afaea2ecf0703577ac936b11e295969d8a35a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency logRelease files / common_image_tools-1.1.0-py3-none-any.whl
| Download URL | common_image_tools-1.1.0-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
988a1b31b4e60dbf09d1790b1da9f069ea3dc68f7e2ca5b51f752c1907e00c04
|
|
BLAKE2b-256 checksum How to use checksums |
3a35f60be8194397eddb8f54524fbc257236b45ff49820f2fa4bb91b61019b17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency logSecurity for common-image-tools 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for common_image_tools-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.