Convert Wand image to GTK image

31 Views Asked by At

Context: Debian 11, Python 3.9.2, PyObject GTK 3.0, WAND 0.6.5

I currently use PIL and to load image in GTK I do:

data = pil_img.tobytes()
pixbuf = GdkPixbuf.Pixbuf.new_from_data(data,  ...)

I want to do the same thing with WAND and have tried data = wand_img.make_blob() but it doesn't work, GTK answers "constructor returned NULL"

Thankfully using numpy works: data = numpy.array(wand_img).tobytes()

So what? The problem is that going through numpy is very slow, causing me to lose 400 ms compared with PIL, which makes the application much less responsive.

Is there a way to convert WAND image to bytes without using numpy ?

0

There are 0 best solutions below