Convert single and multiple numpy images to a gif image without PIL or pillow
Project description
# numpy2gif Python library to convert single and multiple numpy images to a gif image without PIL or pillow. OpenCV does not support gif images. This a fork of array2gif from Tanya Schlusser found at: https://github.com/tanyaschlusser/array2gif
Install it with
setup.py install
or with
pip install numpy2gif
# Usage
You can use the library this way:
from __future__ import print_function from numpy2gif import write_gif import cv2 images = [cv2.cvtColor(cv2.imread(“Images/number”+str(i)+”.bmp”), cv2.COLOR_BGR2RGB) for i in range(1, 5)] print(type(images[0])) print(images[0].shape, images[0].dtype) write_gif(images, “countdown.gif”, fps=3) write_gif(images[0], “one.gif”)
Try a backward test from converting a gif to numpy frames with the external module gif2numpy and back to a multiple gif image with numpy2gif:
from __future__ import print_function from gif2numpy import convert from numpy2gif import write_gif import cv2
image = “Images/Rotating_earth.gif” frames, exts, image_specs = convert(image, BGR2RGB=False) print(“len(frames), len(exts), exts[0][‘delay_time’]”, len(frames), len(exts), exts[0][‘delay_time’]) write_gif(frames, ‘Rotating_earth_new.gif’, fps=12) write_gif(frames[0], ‘earth.gif’)
# Version history
1.0: first release
# Dependencies
You need to install numpy by:
pip install numpy
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file numpy2gif-1.0.zip
.
File metadata
- Download URL: numpy2gif-1.0.zip
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf1be17e018005a4b0a91669fd68da1a789f3c3de9bc58f27d8f83380b9477f2 |
|
MD5 | 341c1312ef675a85c5d9abb449fd7724 |
|
BLAKE2b-256 | 243230898c9742f37147b3d8d3f1020e5d9d544a52920aa3ccbd6b90f1b79eb5 |