如何在pixbuf中转换PIL图像?我试图改变许多例子,但没有解决方案
import array
from gi.repository import GdkPixbuf
def image2pixbuf(self,im):
arr = array.array('B', im.tostring())
height, width = im.size
return GdkPixbuf.Pixbuf.new_from_data(arr, GdkPixbuf.Colorspace.RGB,
True, 8, width, height, width * 4)
Run Code Online (Sandbox Code Playgroud)
错误
TypeError: new_from_data () takes Exactly 9 arguments (7 given)
Run Code Online (Sandbox Code Playgroud)
我使用Pygobject https://live.gnome.org/PyGObject