The default value of the quality attribute in the PHP imagepng () function

According to the official PHP documentation, the imagepng () function has the following signature:

bool imagepng ( resource $image [, string $filename [, int $quality [, int $filters ]]] )

Now I need to know what the standard quality value of $ is. I can not find it anywhere in the documentation.

Is there a source that explains this or anyone who knows about it?

+3
source share
3 answers

from php source (gd.h):

/* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all,
* 1 is FASTEST but produces larger files, 9 provides the best
* compression (smallest files) but takes a long time to compress, and
* -1 selects the default compiled into the zlib library.
*/

Conclusion: Based on the Zlib manual (http://www.zlib.net/manual.html), the compression level is set to 6 by default.

+9
source

from: http://us2.php.net/manual/en/function.imagepng.php

Compression level: from 0 (no compression) to 9.

default value is 0

+1
source

php 0. , .

static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
{
    zval * imgind;
    char * file = NULL;
    long quality = 0 , type = 0;
0
source

All Articles