imagemagick: create a .png file which is just a solid rectangle

Jason S picture Jason S · Oct 14, 2011 · Viewed 18.5k times · Source

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.

Answer

Mike Flynn picture Mike Flynn · Oct 14, 2011

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:

convert -size 100x100 xc:#990000 whatever.png