Re: Trouble displaying a jpeg image

Jeffrey Britton <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAJTKU_ifpQtQvCjMxCBdNN2x6gYDoM0Rn=XLZwJpZV-EuzJXJg@mail.gmail.com>
Thanks.

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.width())
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 <[email protected]> wrote:

>
>  As per my understanding there is no jpeg image decoder in cairo. only png
> surfaces were supported.
> -vicky
>
>>
>>
>>

--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.