Skip to content

Single-function module to write a numpy array to grayscale GIF.

Notifications You must be signed in to change notification settings

clemisch/numpy2gif

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

This module only has one function: gif_gray. Use it to create a grayscale GIF from a 3D numpy array.

import numpy as np
from numpy2gif import gif_gray

# generate 3D data
# gif will play over 0th axis
data = np.random.normal(loc=0, scale=100, size=(30, 100, 200))

# generate gif file
# input will be scaled to [0, 1] automatically
# `fname` can be relative or absolute
gif_gray(data, fname="hello_world.gif", fps=10)

generates file hello_world.gif:

example

Keep in mind that the input array is scaled linearly to [0, 1], so you won't see much if your data is not linearly scaled in the first place.

About

Single-function module to write a numpy array to grayscale GIF.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages