Python 如何将numpy数组转换为wand.image.image对象?

Python 如何将numpy数组转换为wand.image.image对象?,python,numpy,wand,Python,Numpy,Wand,我想将numpy数组保存为.dds文件,下面是我获取数组的方法: import numpy as np from wand import image with image.Image(filename='test.dds') as dds: arr = np.array(dds) 获取阵列后,我需要使用以下代码将其保存为另一个.dds文件: dds.compression = 'dxt5' dds.save(filename='test2.dds') 但dds似乎必须是一个wand

我想将numpy数组保存为.dds文件,下面是我获取数组的方法:

import numpy as np
from wand import image

with image.Image(filename='test.dds') as dds:
    arr = np.array(dds)
获取阵列后,我需要使用以下代码将其保存为另一个.dds文件:

dds.compression = 'dxt5'
dds.save(filename='test2.dds')
但dds似乎必须是一个wand.image.image对象,所以我的问题是,如何将numpy数组转换为wand.image.image对象?

我想您需要:

# Make wand Inage from Numpy array
wi = Image.from_array(numpyArray)

您正在从数组中查找
魔杖.image.image.:

ndds = dds.from_array(arr)
ndds.compression = 'dxt5'
ndds.save('test2.dds')