[cairo] Trouble displaying a jpeg image
jeffb0098 at gmail.com
Sat Jan 7 19:14:38 PST 2012
In case it helps anybody, the following ended up being the fastest and most
direct method that I could work out.
Nonetheless, the conversion from rgb to bgra is quite slow(150ms on my
single core 2.9Ghz machine) and should be done in 'C'.
I tried Cython with no signifcant improvement.
img = Image.open(fn)
l = [struct.pack('BBBB', b, g, r, 0xFF) for (r,g,b) in img.getdata()]
s = string.join(l, '')
self.img = array.array('B', s)
stride = cairo.ImageSurface.format_stride_for_width(cairo.FORMAT_ARGB32,
self.img_surface = cairo.ImageSurface.create_for_data (self.img,
cairo.FORMAT_ARGB32, self.width(), self.height(), stride)
On Sat, Jan 7, 2012 at 1:20 AM, Vicky Tux <ssseintr2 at gmail.com> wrote:
> As per my understanding there is no jpeg image decoder in cairo. only png
> surfaces were supported.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cairo