blob: 96d9d90d279af3905650db8e11139ef99bee7e19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include "imageutils.h"
#include "lodepng.h"
#include <stdio.h>
#include <stdlib.h>
bool write_png(std::ostream &output, unsigned char *pixels, int width, int height)
{
//encoder.settings.zlibsettings.windowSize = 2048;
//LodePNG_Text_add(&encoder.infoPng.text, "Comment", "Created with LodePNG");
size_t dataout_size = -1;
unsigned char *dataout = (unsigned char *)malloc(width*height*4);
LodePNG_encode(&dataout, &dataout_size, pixels, width, height, LCT_RGBA, 8);
output.write( reinterpret_cast<const char*>(dataout), dataout_size );;
free( dataout );
return true;
}
|