Sam Crowther
Sam Crowther

Reputation: 21

How to make image 2D and RGB

I'm using iageio.imwrite() when using this i keep getting a ValueError saying image must be 2D (grayscale, RGB, or RGBA). My input array has a size of 20,125,125. Is this the issue?

imageio.imwrite('patterns.gif',u_e, format = 'GIF-PIL', fps = 100)

Upvotes: 1

Views: 5481

Answers (1)

Andrea
Andrea

Reputation: 3077

If I understood correctly, you want to create a .gif with 20 frames (first dimension of u_e), each frame being a 125X125 grayscale image. If that's the case, I would use the mimsave function instead of imwrite:

imageio.mimsave('patterns.gif', u_e, format = 'GIF-PIL', fps = 100)

Here's the output:

enter image description here

Upvotes: 2

Related Questions