Skip to main content

pImage

The goal of this package is to provide a common and unified API for reading and writing sequences of 2D arrays from farious formats to python numpy arrays, and the other way around. It uses openCV lib for most of the job, and Pillow for some cases (as gif for example) As a supplementary feature, this package also allows for manipulating numpy arrays for esthetic purposes :

  • providing classes to snap together multiple arrays synchronized in a single output (mutiple videos layed out next to each other in a singe avi or gif for example),
  • helper functions for making colored arrays (3D RGB arrays) from arrays of 1D values, using colormaps
  • save matplotlib plots outputs to rasterized RGB arrays, in order to be used in the API like any other array and be saveable in videos.
  • provide image transformations functions (contrast, brightness, clahe, padding, cropping, gaussian filtering, sharp filters, text annotation) to 2D or 3D arrays, and be able to perform these at read time from a single frame of a reader function (in order to minimize RAM load when working with very large videos).
  • For the same purpose of minimizing RAM load, a reader and writer can be piped together so that the later writes frames to disk as soon as the reader provides a frame, keeping RAM usage low during vide conversion (as well as video tratment, as a reader can be transformed into a "transforming_reader" using any transformation function cited above.)

Usage :

Simple guide for video compression :

import pImage

input_video_path = r"foo/myfoovideo.seq"
output_video_path = r"bar/myconvertedfoovideo.avi"

converter = pImage.Standard_Converter(input_video_path, output_video_path)
converter.start()

Implement progressbar for files of over 100 frames. Once finished, the script will display Done in console

Under the hood :

It automatically selects a reader and a writer depending on the extension of your input and output video pathes, and performs reading and writing on different processes to maximize speed in case reading and writing are done on different hard drives. (for multi-core processors) With optionnal arguments, one can also make the converter execute any function provided to it inbetween the reader and writer to modify the images as wished. (rotation, scale, LUT ,image enhancement, CLAHE, etc..)

The writer is a class that will generate the file and work variables only at first writer.write(frame) call. That way, it avoids anticipatory declarations of width, height, data type etc at instanciation, an will still work as long as you keep feeding consistant data to the object.

Notes for dev for me later :

Reduce RAM usage intensity for mosaics of snapped and resized videos, by using https://pythonspeed.com/articles/mmap-vs-zarr-hdf5/ ZARR instead of numpy memmaps (numpy memmaps rely on OS APIs and are not well tuneable (at least on windows) + not efficient timewise + proved to not even be usefull regarding ram as memaps starts to discharge from ram only when ram is completely saturated, making the computer practically unuseable in the background, a shame for a main station running analysis while working on something else....)

Metadata

Release files for easimage 3.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for easimage 3.0.6
File Size Uploaded
easimage-3.0.6.tar.gz 166.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for easimage 3.0.6
File Interpreter ABI Platform
easimage-3.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 278.5 kB

Release files / easimage-3.0.6.tar.gz

Download URL easimage-3.0.6.tar.gz
Size 166.4 kB
Tags Source
SHA-256 checksum
How to use checksums
95d0bcedf126342501df575380bd7504b62965b3df720db1b70c8accf3a41345
BLAKE2b-256 checksum
How to use checksums
9f568c63256e1c65bde8634bd940c5dbb706e7d19a83dab652bdaacd58b6ad03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.27.0 CPython/3.12.3 Linux/6.17.0-1013-azure

Release files / easimage-3.0.6-py3-none-any.whl

Download URL easimage-3.0.6-py3-none-any.whl
Size 112.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa1de461663d7f4fd1c95ac8b4b55a0f86f138154fec6a2f37c8a53adaa243b4
BLAKE2b-256 checksum
How to use checksums
618137a528ef877c5a66fa7b38bb23980f438e75e37bab8d9c111c6b5f3fe62f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.27.0 CPython/3.12.3 Linux/6.17.0-1013-azure

Release history Release notifications | RSS feed

This release

3.0.6 This release

2 release files

3.0.5

2 release files

3.0.3

2 release files

3.0.2

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page