Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Help converting a bitmap to a png in memory using libpng

Tags:

c

bitmap

libpng

Basically I would like to convert a bitmap to a png using libpng but rather than outputting it to a FILE* I would like to output it to a char*. I have already seen this related post but I don't see where the bitmap data is actually used. Any help would be appreciated.

like image 231
dlee123 Avatar asked Sep 17 '10 23:09

dlee123


1 Answers

Use the png_set_write_fn function to redirect writes to your own function; this function, which you need to write, can store the output in any way you want.

See the documentation at http://www.libpng.org/pub/png/libpng-manual.txt

like image 104
Mark Ransom Avatar answered Sep 29 '22 17:09

Mark Ransom