哪些 PHP 压缩实用程序和设置将模仿 Photoshop 的“另存为 Web”?
我已经尝试了大约六个压缩实用程序,但无法达到 Photoshop 的“另存为 Web”功能所获得的压缩级别(小 5-10 倍)。我认为问题在于大多数实用程序无法在压缩过程中更改图像的位深度。
我想使用 PHP 压缩实用程序(如果可能的话)。
我对 Photoshop 的“另存为 Web”的设置是:
png-8
selective
diffusion
no transparency
64 colors
100% dither
I've tried about a half dozen compression utilities and have been unable to get anywhere near the compression level that Photoshop's "Save for Web" feature gets (5-10x smaller). I think the problem is that most of the utilities can't change bit depth of the image as part of the compression process.
I'd like to use a PHP compression utility (if possible).
My settings on Photoshop's "Save for Web" are:
png-8
selective
diffusion
no transparency
64 colors
100% dither
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果大小差异很大,那么您可能是对的,并且它不会减少位深度。 ImageMagick 将为您提供良好的控制能力。 PS“保存为网络”所做的另一件事是删除大部分元数据,但这种节省通常非常小。
使用 ImageMagick,您可以使用
png8:filename.png
格式来表示 8 位 png,您必须查看文档才能获取其余的属性设置,但请注意,对于 PNG,质量设置与 jpg 等有损格式不同,每个数字代表不同的 png 设置。要使用,请安装 ImageMagick 库,然后通过 PHP exec 函数之一运行命令或安装 PHP PECL 扩展,imagick。
If it's a dramatic difference in size, then you are probably right and it's not reducing the bit-depth. ImageMagick is going to give you a good amount of control. The other thing that PS "save for web" does is strip most of the meta-data, but that savings is usually pretty minimal.
Using ImageMagick you can use the format
png8:filename.png
for 8-bit pngs, you'll have to look at the documentation to get the rest of the attribute settings, but note that for PNGs, the quality setting is not the same as lossy formats like jpg, each digit represents a different png setting.To use, install the ImageMagick library and either run the commands via one of the PHP exec functions or install the PHP PECL extension, imagick.
Imagemagick 是一个很好的 PHP 图像实用程序,大多数开发人员都使用它来实现高级图像算法。我建议您研究此实用程序以满足进一步的图像处理需求。具体来说是 Imagick::setCompressionQuality
PHP Imagemagick
Imagemagick is a nice PHP image utility and is used by most developers for advanced Image algorithms. I would recommend looking into this utility for further image manipulation needs. Specifically Imagick::setCompressionQuality
PHP Imagemagick
转换 - ImageMagick 的控制台变体...
只需玩一下设置...
convert - console variant of ImageMagick...
just play with settings...