imagemagick:创建一个 .png 文件,它只是一个实心矩形
我想创建一个纯色的 .png 文件。
使用 ImageMagick 一定很容易做到这一点,但我无法找出问题所在:
C:\tmp>convert -size 8x16 -stroke black -fill black -draw "rectangle 0,0,8,16" black.png
Magick: missing an image filename `black.png' @ error/convert.c/ConvertImageComm
and/3016.
I want to create a .png file which is just a solid color.
This must be easy to do using ImageMagick but I can't figure out the problem:
C:\tmp>convert -size 8x16 -stroke black -fill black -draw "rectangle 0,0,8,16" black.png
Magick: missing an image filename `black.png' @ error/convert.c/ConvertImageComm
and/3016.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
显然,可以有更多选项,例如边框等,但如果您只想要给定十六进制颜色的宽度 x 高度的图像,那么它非常简单。
以下是制作 100x100 纯深红色图像所需的全部操作:
Obviously there can be more options, like borders and etc, but if you just want an image of width x height of a given hex color, it's pretty straight forward.
Here's all it takes to make an 100x100 image of a solid dark red:
请注意,对于 rgb 和 rgba 值,您需要转义括号。以@Mike Flynn 和@luk3thomas(正确转义颜色代码)为基础:
Note that for rgb and rgba values, you need to escape the parentheses. Building on @Mike Flynn and @luk3thomas (who correctly escapes the color code):
在苹果电脑中
In Mac