Saving PNGs

Hello!

I have to save an SDL surface to a PNG file. Right now, I’m using SDL_SaveBMP
and then Gimp for converting it to PNG, but I need the alpha channel as well,
so I have to create the PNG directly in my application.

Is there any free library that does that, or a simple example code I can use?

Thanks,
Marian.

Marian Schedenig wrote:

Is there any free library that does that, or a simple example code I can use?

http://www.google.fr/search?hl=fr&ie=UTF-8&oe=UTF-8&q=PNG&btnG=Rechercher&meta=

First result

Julien

Why, yes! libPNG! ;^)

I use it directly inside of Tux Paint. See:

http://www.newbreedsoftware.com/tuxpaint/download/source/

-bill!On Tue, May 11, 2004 at 03:37:23PM +0200, Marian Schedenig wrote:

Hello!

I have to save an SDL surface to a PNG file. Right now, I’m using SDL_SaveBMP
and then Gimp for converting it to PNG, but I need the alpha channel as well,
so I have to create the PNG directly in my application.

Is there any free library that does that, or a simple example code I can use?

Well, I was talking about generating PDFs from SDL surfaces. Which is why I
didn’t google for any “normal” PNG libs. Anyway, your link still helped, in
combination with the TuxPaint sources I was able to write the RBGA PDF saving
function I needed.

So thanks. :slight_smile:

Marian.On Tuesday 11 May 2004 16:18, Julien Pauty wrote:

Is there any free library that does that, or a simple example code I can
use?

http://www.google.fr/search?hl=fr&ie=UTF-8&oe=UTF-8&q=PNG&btnG=Rechercher&m
eta=

First result


“A moose is an animal with horns on the front of his head and a hunting lodge
wall on the back of it.” - Groucho Marx

Thanks. I already took a look at your code, and it helped me pass an SDL
surface to libpng (which was my main problem).

Everything works fine now, except that it’s really slow (noticeable delay when
making a screenshot). But for now it’s good enough. :slight_smile:

Marian.On Tuesday 11 May 2004 20:51, Bill Kendrick wrote:

Is there any free library that does that, or a simple example code I can
use?

Why, yes! libPNG! ;^)

I use it directly inside of Tux Paint. See:


“A moose is an animal with horns on the front of his head and a hunting lodge
wall on the back of it.” - Groucho Marx