librelist archives

« back to archive

Reading raw RGBA

Reading raw RGBA

Jesper Larsen
2014-11-18 @ 11:18
Hi Wand users and developers

I am currently using PIL/Pillow for quantizing RGBA images created with 
matplotlib on the fly and converting the resulting image to a paletted 
PNG. It is used in a web application where both image size and speed is 

Pillow is great for this but I am always trying to remove further 
milliseconds from the responses that we produce. So I have begun looking 
at wand and been doing some initial performance comparisons.

It seems like I can get better performance from wand. But unfortunately 
this performance improvement is offset by the fact that with Pillow I can 
let matplotlib write the image as raw RGBA (to a cStringIO) and Pillow 
read it in directly. And matplotlib is quite fast at this. With wand it 
seems like I have to let matplotlib write the image encoded in e.g. RGBA 
PNG format and then read it into wand. This is unfortunately slow (writing
the png in matplotlib).

So my question is: Can wand read raw RGBA images (I do of course realize 
that I must provide size information)?

Best regards,

Ps. I used this for quantizing in wand: