[Xcb] Best way to load a png/jpeg file when using XCB?

Vincent Torri vtorri at univ-evry.fr
Sun Jul 4 10:28:20 PDT 2010

On Sun, 4 Jul 2010, Michael Stapelberg wrote:

> Hi Vincent,
> Thanks for your answer.
> Excerpts from Vincent Torri's message of 2010-07-04 18:40:04 +0200:
>> 1) A full framework, using XCB, which will read / decompress your image
>> file to something that suits your needs
> A library which loads the image and provides me data I can then draw on a
> pixmap would be the best way, yes. I think an imlib2 version which works
> with xcb would be a pretty good way.

I can say : Evas (http://www.enlightenment.org) but i think it's too much 
for what you want.

>> 2) or just some code that read / decompress the image file, and after
>> that, you put the data in an xcb_image
> As long as the code is not too long (say, 100-200 SLOC) that would also
> be ok.

I doubt you'll find some code around 100-200 lines of code for 
decompressing an image file (if you want to be generic).

Anyway, you may look at the code here :


There are several subdirectories, each for one decompressing method (you 
have xpm decoder here, and i've seen that, in the current i3lock code, you 
just need xpm support, so it can help you. But it's around 500 lines of 

Note that the licence of that code is a modified BSD one (read COPYING and 
COPYING-PLAIN for more info), so it should be compatible with your MIT 

Wait for other people to answer. They can have others ideas for what you 



More information about the Xcb mailing list