Skip to main content

# 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

Release files for numpy2gif 1.0

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

Source distribution (sdist)

Source distribution for numpy2gif 1.0
File Size Uploaded
numpy2gif-1.0.zip 8.6 kB Details

Release files / numpy2gif-1.0.zip

Download URL numpy2gif-1.0.zip
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bf1be17e018005a4b0a91669fd68da1a789f3c3de9bc58f27d8f83380b9477f2
BLAKE2b-256 checksum
How to use checksums
243230898c9742f37147b3d8d3f1020e5d9d544a52920aa3ccbd6b90f1b79eb5
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0 This release

1 release file

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