我目前正尝试在 PHP 中使用 ImageMagick 量化图像,它工作正常,但不保留 alpha channel 。如果我遍历每个像素并计算量化前 alpha 值为 0 的像素数,这是正确的,但在量化后,几乎所有图像的 alpha 值为 0。
有没有办法在量化过程中保留这些数据?
最佳答案
当使用命令行 imagemagick 工具时,有一种方法可以忽略 alpha channel :
convert alpha_gradient.png -quantize transparent +dither -colors 15 alpha_colors_15qt.png
选项“-quantize transparent”可以做到这一点。 PHP 是什么样子的?
关于php - 在 ImageMagick 中量化图像时保留 alpha channel ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7282852/
相关文章:
visual-studio - Visual Studio 安装项目预生成事件
security - 如何在 Web 应用程序中保护 HTML 电子邮件?
drupal - 如何总结 drupal 7 中 View 表的列?
macos - 什么类型的文件可以在 Mac 上使用 codesign 进行签名?
android - 向 RadioGroup 和 Radiobutton 添加过渡动画
visual-studio - Visual Studio 中的自定义构建规则,具有多个输出