image - Transparency on Imagemagick
问题描述
I'm using this code wrote on ImageMagick, but I want this background:
In order to match the color of my terminal, which is #000
with 70% opacity. If I leave it without background, it just goes completely transparent:
And no matter what I do, it doesn't works or it makes the image missing. I've searched through the ImageMagick code on forums and here on StackOverflow, but I couldnt make it work.
解决方案
在 ImageMagick 中,要获得不透明度为 70% 的 #000 或黑色或 rgb(0,0,0),请使用
"rgba(0,0,0,0.7)"
或最接近的十六进制值是
#000000b3
所以你的转换命令应该是:
convert input.suffix -resize 300x -gravity center -background "rgba(0,0,0,0.7)" -extent 1100x400 output.png
不要保存为 JPG,因为它不支持透明度。
如果在类 Unix 系统上或在逗号之间放置空格,请保留引号。
推荐阅读
- php - 在 if 语句 Laravel 中使用下拉列表中的选定值
- php - 函数 static::created 无法正确保存 Laravel
- laravel - Intervention\Image\Exception\NotWritableException 无法将图像数据写入路径
- c - 如何将一个变量的字符串分配给另一个变量?
- javascript - 反应自定义组件(数据表)
- scala - 如何从头文件创建数据框架构
- sql-server - 遇到特定 Error_Number 时执行脚本/存储过程
- php - field_to_name_array - 取二级相关数据
- sql - Postgres 轮换 cron 备份
- android - 如何证明 Android Studio 中的内容 - XML