Imageio is a Python library that provides an easy interface to read and write a wide range of image data including animated images, volumetric data, and scientific formats. Make to use this tag for question related to it.
Questions tagged [python-imageio]
191 questions
1
vote
1 answer
ffmpeg plugin imageio on Python
I simply try to call
from moviepy.editor import VideoFileClip
but I receive this error
File "/Users/macbook/python/main_video.py", line 3, in
from moviepy.editor import VideoFileClip
File…

No Chance
- 11
- 3
1
vote
1 answer
Python: ImageIO ValueError in VirtualEnv
I'm using imageio to generate a GIF from a set of PNGs that I've created using PIL. Here's my code (found here):
import imageio
path = "./img/"
os.chdir(path)
filenames = sorted((fn for fn in os.listdir('.') if…

Felipe Mulinari Rocha Campos
- 91
- 1
- 8
0
votes
0 answers
I'm using imageio.imread, the folder has 22 tif files the shape of the matrix I get is (514 1030 4), I expect (514 1030 22)
(First time user)
I want to read tif files from a folder.
N=22 (the number of tif files in the folder)
The name of the folder is: tif_files
The file names start at E_0 and ends at E_21
I'm reading the folder using:
for i in range(N):
im =…

Photons are fun
- 1
- 1
0
votes
1 answer
How to make an animated set of images with a working duration per image
I want to make an animated set of images in python. I can't use an animated gif as I need more than 256 colors. I have tried an animated png but it seems the duration argument doesn't work. Here is a MWE:
import seaborn as sns
import io
import…

Simd
- 19,447
- 42
- 136
- 271
0
votes
0 answers
How to save HDR file with numpy array?
I try to save HDR file with numpy array as follows.
numpy array like this (dtype:np.float32)
# hdr_file_data
[[[0.32543945, 0.38671875, 0.44213867],
[0.30029297, 0.34204102, 0.3737793 ],
[0.2697754, 0.28515625, 0.28295898],
[0.2388916, …

陆一凡
- 137
- 1
- 11
0
votes
0 answers
Pythong imageio.v3 OverflowError: Python int too large to convert to C long
I am getting "Python int too large to convert to C long" when executing out_file.init_video_stream("vp9", fps=fps)
Maybe my video is to large is the cause of it? (vidoe info size: 146MB, 1920x960, total bitrate 4187kbps)
I am using python3.10 and…

Jcheong
- 21
- 6
0
votes
0 answers
How can I create a random pattern flashing at specific frequency in Python for GIF creation?
I am trying to write a code that creates a random pattern flashing (twinkling) at a specific frequency. Below is the code I am using, but the problem is that, different frequencies (frame rates) that I set for the pattern to flash will show the same…

Fatemeh DND
- 1
- 1
0
votes
2 answers
increassing jpeg compression in the tifffile library
I'm saving numpy arrays as jpeg compressed tiff files in the following way
import tifffile
import numpy as np
im = np.zeros((4,256,256))
tifffile.imsave('myFile.tif' , im, compression = 'jpeg' )
What I'm wondering is whether there is a…

Daniel van der Maas
- 91
- 3
0
votes
1 answer
ValueError: Could not find a backend to open `my_path` with iomode `wi`
Code snippet giving the error:
for i in range(masks.shape[0]):
imsave(os.path.join(PATH_TO_SAVE, f"prediction_{(i+1):04d}"), masks[i])
Error message:
"ValueError: Could not find a backend to open `my_path` with iomode `wi`"

Phantom
- 71
- 4
0
votes
1 answer
skimage/imageio fails to read grayscale images
I have been reading images using (Python) skimage.imread (or imageio.imread) for months successfully, but now, without changing the code, I get failures when reading grayscale images. My collaborators can read the files. The image properties are:
…

peter.murray.rust
- 37,407
- 44
- 153
- 217
0
votes
0 answers
Python imageio: What is the best way to transfer video over TCP?
I have a python program running on an embedded Linux board (like a raspberry pi), and another python program running on my PC.
I am trying to use the imageio library as a way of capturing frames from the webcam (e.g., pi camera) of the linux board,…

Yann Bouteiller
- 47
- 7
0
votes
2 answers
Fastest way to load an animated GIF in Python into a numpy array
Surprisingly I couldn't see any coverage of this.
I've found 3 recognised ways of performing this - Pillow, OpenCV, and Imageio. The results surprised me, so I've posted them as a self-answering Q&A (below).

James
- 363
- 1
- 4
- 14
0
votes
2 answers
Fast way to convert string to numpy ndarray
I am currently doing a python program to convert from image to hex string and the other way around. I need two functions, one that takes an image and returns a hex string that corresponds to the RGB values of each pixel, and another function that…

Rararat
- 53
- 6
0
votes
1 answer
GIF not getting saved while using ImageIO/PIL
I am trying to use both ImageIo and PIL to save a sequence of my images as GIF. The images do get saved in a .gif file. But, they are getting saved as a sequence of images and not as a "video" GIF.
gif_images[0].save('path/test.gif', save_all=True,…
0
votes
0 answers
In order to send videos as response in flask I have to save them?
Im build an API that generates a video from a NumPy array.
from skimage import img_as_ubyte
import imageio
imageio.mimsave('temp/{}.mp4'.format(id), [img_as_ubyte(frame) for frame in predictions], fps=fps)
however, I need to send this video as a…