On Tue, 2008-03-11 at 15:15 +0100, Duncan Webb wrote: > Rob Shortt said the following, on 11.03.2008 14:46: > > Hi Adam, > > > > Adam Charrett wrote: > > > >> Right annoyingly I thought pygame could do this, although it appears it > >> will only be able to do it from the next release (1.8). > >> > > > > I ran into that also. > > > > > > > >> So my question is what is the best way to take a pygame.Surface and save > >> it as an 8bit paletised/indexed PNG? > >> > >> It needs to be an index PNG as Vlc won't load anything else for its logo > >> filter which I am going to use to display an OSD. > >> > >> Any help would be much appreciated, I've had a look a kaa.imlib2 but its > >> not clear to me whether I can specify the format of the PNG. I haven't had > >> a look at PIL yet, but I was hoping to keep the dependencies the same as > >> freevo 1. > >> > > > > My first thought was PIL, but kaa.imlib2 should work fine as well. Take > > a look at some of the mevas code in the kaa SVN. You'll likely need to > > use the pygame Surface fromstring()/whatever and create in imlib2 or PIL > > image with that data (both libraries have that ability). I think you > > can specify the image format in imlib2, or create it as raw and then > > convert it to the PNG you need. > > > > I had a look at the imlib2 C code and it is not clear how to specify how > to set the format to 8 bit, I noticed that imlib2 uses lib png for > loading an image and I guess saving one too. > > Duncan
Thanks all, a quick look at the source code of imlib2 seemed to suggest to me that it was hardcoded to ARGB for PNG, but PIL worked fine. Unfortunately it seems to be a wasted learning experience as Vlc logo filter works fine when used as a video filter, but you can't move/change it. As a sub filter, which can be moved/changed, the colours are completely wrong, I assume something todo with conversion to a YUV palettised surface in Vlc. Oh well, next step an X only solution for graphics OSD not what I wanted, but gstreamer is not mature enough yet to include dvb subtitles. Thanks again Adam ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel