From: oetiker Date: Sun, 3 Apr 2005 11:11:50 +0000 (+0000) Subject: improve png writing speed by lowering the compression X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f4d346969db592ebf8cfb6207df3842c09e62c01;p=rrdtool-all.git improve png writing speed by lowering the compression git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@333 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/src/rrd_gfx.c b/program/src/rrd_gfx.c index 253c7a63..49b93685 100644 --- a/program/src/rrd_gfx.c +++ b/program/src/rrd_gfx.c @@ -719,12 +719,19 @@ static int gfx_save_png (art_u8 *buffer, FILE *fp, long width, long height, lon text[0].compression = PNG_TEXT_COMPRESSION_NONE; png_set_text (png_ptr, info_ptr, text, 1); + /* lets make this fast */ + png_set_compression_level(png_ptr,1); + png_set_filter(png_ptr,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS); + /* + png_set_filter(png_ptr,PNG_FILTER_TYPE_BASE,PNG_FILTER_SUB); + png_set_compression_strategy(png_ptr,Z_HUFFMAN_ONLY); + png_set_compression_level(png_ptr,Z_BEST_SPEED); */ + /* Write header data */ png_write_info (png_ptr, info_ptr); - for (i = 0; i < height; i++) row_pointers[i] = (png_bytep) (buffer + i*rowstride); - + png_write_image(png_ptr, row_pointers); png_write_end(png_ptr, info_ptr); png_destroy_write_struct(&png_ptr, &info_ptr);