PHP imagepng() 函数中质量属性的标准值

发布于 2024-10-25 00:33:36 字数 234 浏览 1 评论 0原文

根据 PHP 的官方文档,imagepng() 函数具有以下签名:

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

我现在需要知道的是 $quality 的标准值是多少。我在文档中找不到它。

有没有一些资料来源可以解释它或任何了解它的人?

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

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

What I need to know now is what the standard value of $quality is. I cannot find it anywhere in the documentation.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

中二柚 2024-11-01 00:33:36

来自 php 源代码(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.
*/

结论:
根据 Zlib 手册 (http://www.zlib.net/manual.html),默认压缩级别设置为 6。

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 default compression level is set to 6.

要走就滚别墨迹 2024-11-01 00:33:36

来自:https://www.php.net/manual/en/function。图片png.php

压缩级别:从0(无
压缩)至 9。

默认值为 0

from: https://www.php.net/manual/en/function.imagepng.php

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

default value is 0

瑕疵 2024-11-01 00:33:36

在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;

In php's source code quality parameter was defaulted to 0. But i havent idea for which value is optimal for image processing.

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;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文