Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 删除使用imageio或PIL创建的GIF中的空间插值或压缩_Python_Pillow_Python Imageio - Fatal编程技术网

Python 删除使用imageio或PIL创建的GIF中的空间插值或压缩

Python 删除使用imageio或PIL创建的GIF中的空间插值或压缩,python,pillow,python-imageio,Python,Pillow,Python Imageio,我正在尝试使用imageio创建GIF。这是相当直接的;然而,图像的质量很差。它们似乎是插值的。见下图 我正在使用下面显示的代码创建GIF。我试着在源代码中跟踪图像是如何生成的,问题似乎来自PIL from PIL import Image import imageio import numpy as np import matplotlib.pyplot as plt outdir = r"where/you/want/it/to/go.gif" frames = np.round(100+

我正在尝试使用imageio创建GIF。这是相当直接的;然而,图像的质量很差。它们似乎是插值的。见下图

我正在使用下面显示的代码创建GIF。我试着在源代码中跟踪图像是如何生成的,问题似乎来自PIL

from PIL import Image
import imageio
import numpy as np
import matplotlib.pyplot as plt

outdir = r"where/you/want/it/to/go.gif"
frames = np.round(100+20*np.random.randn(10, 40, 40)).astype(np.uint8)

# Create single gif frame with PIL
im = Image.fromarray(frames[0])
im.save(outdir)

# Create gif with imageio
imageio.mimsave(outdir, frames)
我想要一个看起来像我用
matplotlib
生成的顶部图像(无插值)的GIF。底部的图像是使用
imageio
生成的单个帧