Skip to content
write animated GIF, multipage append TIFF, AVI OGV video in Python
Branch: master
Clone or download
Latest commit d75a3bc Jan 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
archive modernize:pep8,mypy Jul 10, 2018
doc fix scripts relative Jun 21, 2018
pyimagevideo [skip ci] Dec 31, 2018
tests better skip logic Aug 15, 2018
.appveyor.yml CI skip Aug 15, 2018
.codeclimate.yml
.coveragerc
.gitattributes
.gitignore ignore [ci skip] Jul 24, 2018
.travis.yml CI template Jan 23, 2019
Demo_localBinaryPattern.py
FPS_matplotlib_image.py [skip ci] Dec 31, 2018
HDF5_to_AVI.py [skip ci] Dec 31, 2018
LICENSE Initial commit Feb 13, 2015
README.md
RGB_BGR_GBR_conv.py
audio_oct2py.py pep8 mypy Jun 21, 2018
audio_octave.m Squashed commit of the following: Mar 28, 2018
audio_pyaudio.py
audio_pygame.py pep8 mypy Jun 21, 2018
audio_pysounddevice.py pep8 mypy Jun 21, 2018
demo_findpeaks.m findpeaks Nov 9, 2015
demo_findpeaks.py pep8 mypy Jun 21, 2018
imageconv.py pep8 mypy Jun 21, 2018
implay.m
lossless.m lossless mj2 Jan 18, 2016
pgm_multiread.m
readAVI_imageio.py pep8 mypy Jun 21, 2018
readAVI_octave.m
readAVI_opencv.ipynb
readAVI_opencv.py
readAVIs_opencv.py
scipyByteScaleBug.py
setup.cfg
setup.py
wavelength2rgb.py
writeAVI_imageio.py
writeAVI_matplotlib.py pep8 mypy Jun 21, 2018
writeAVI_opencv.py

README.md

Travis CI status coverage AppVeyor CI Maintainability pypi versions PyPi Download stats

Python Image and Video Read/Write Examples

Functions to write multipage images and make videos from Numpy arrays. Also includes functions to test Matlab and Python OpenCV codecs.

Install

python -m pip install -e .

Scripts

Convert_HDF5_to_AVI.py converts HDF5 video data to AVI. Typically used in biomedical and science imaging, where they use HDF5 instead of TIFF, since HDF5 is a very widespread, fast file format that can store arbitrarily large datasets and metadata. It is recommended to researchers to use HDF5 instead of TIFF, FITS, CDF or proprietary formats for large data streams, including lossless video.

image_write_multipage.py demonstration of writing multipage TIFF from Numpy arrays, using tifffile and freeimage (tifffile is 20x faster and much more featureful)

imageconv.py converts large directory of files with same prefix to multipage TIFFs

Audio

The audio_*.py scripts show several methods for generating audio output from Python.

Python lossless AVI writing

You can write AVI from Python without axes labels (openCV) or with labels/axes (Matplotlib)

OpenCV AVI writing

Demo_OpenCV_writeAVI.py demonstrates using OpenCV to write video, with a lot of codecs to try. This does not insert any of the axes stuff that Matplotlib does, so it can be useful for machine vision work. You can optinally overlay dynamic text on the video.

Matplotlib AVI writing

matplotlib_writeavi.py writes axes labels AVIs lossless using Matplotlib. Note that file-based matplotlib.animation.writers['ffmpeg_file'] is used for better reliability, even though it takes twice as long as the pipe-based ffmpeg. On some computers, pipe-based matplotlib.animation.writers['ffmpeg'] results in very distorted, scrambled output for some reason, with Matplotlib 1.5 and 2.0. In that case, I have empirically found ffmpeg_file to Just Work.

Notes

You can’t perform that action at this time.