[cairo] how to import .BMP without other libs(GTK+ etc)?

Thomas Stover thomas at wsinnovations.com
Wed Feb 4 11:53:03 PST 2009

A similar question came up on the gtk list the other day. Since you are 
looking for a way to do it without using an additional library, this is 
not your answer. However, I have been recommending people try 
ImageMagick http://www.imagemagick.org/script/index.php for "non png" 
file formats and misc raster operations such as resize as a supplement 
to cairo. If you want my demo I can post it here.

Out of curiosity, what are your reasons for not wanting another library? 
I have seen allot of aversion to mixing libraries lately. As long as 
licenses and technical details work out, to me that's how you bring some 
real alchemy to the table.
> From: Tor Lillqvist <tml at iki.fi>
> Subject: Re: [cairo] how to import .BMP without other libs(GTK+ etc)?
>> we could do it with GTK+. However, is there some other way to import BMP or
>> dib in cairo without the suppot of other libs?
> Not as far as I can see.
>> I had tried to do it whit cairo_image_surface_create_for_data, but failed. I could not see the right image.
> Are you sure that the .bmp file you are reading actually is in a
> (sub)format your code can handle? Didn't debugging (or adding
> printouts...) tell you anything? There must be a lot of sample code
> that reads .bmp out there, compare to the code of those... I know of
> io-bmp.c in gtk+/gdk-pixbuf and GIMP's bmp-read.c.
> A "throwaway" program I wrote to dump the contents of a .bmp file is
> at http://pastebin.com/m6e96721e . Unfortunately it compiles as such
> only on Windows.
> --tml

More information about the cairo mailing list