php - `quality` 函数 `imagepng` 中 (`PHP` 参数的默认值是多少)?

标签 php image image-processing image-size image-quality

我在 PHP 中使用了 imagepng 函数来调整图片大小。在当前代码中,我没有指定 quality 参数。

 imagepng($im_dest, $destfile);

但现在我想使用它并根据用户需求提高或降低质量。为此,我需要知道此函数中质量参数的默认值是多少,但不幸的是,我无法在 php.net 网站上找到它。

description of imagepng function in the official website of php

你知道什么是默认值吗? quality 参数是否对输出大小和质量有很大影响?

还有一个问题:在其他地方,我调整了上传图像的大小(到它们的原始大小)以确保没有任何恶意脚本附加到它上面。这是一个好的做法还是没有必要?

非常感谢您的帮助。

最佳答案

当我阅读一些用户贡献的笔记时,我发现了这个并说默认质量设置为 6。

from mhorne69 at gmail dot com

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.

我希望这能回答你的问题:)

关于php - `quality` 函数 `imagepng` 中 (`PHP` 参数的默认值是多少)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25924818/

相关文章:

php - 未识别的 php 语法错误

java - 如何在框架中显示图像?

vb.net通过面板控件将图像分配给picturebox

r - 如何使用 hexSticker 创建 SVG 文件

image-processing - 图像处理项目的遗传算法

javascript - 如何使用 Javascript 打开模态框

php - jQuery JSON - 为什么我收到以下错误?

php - MYSQL数据库如何修改时区?

python - 如果 icc_profile 为空,则识别任何图像的颜色空间 (PIL)

opencv - 交换两个不同图像的直方图