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

In Mac

convert -size 100x100 xc:"#8a2be2" [email protected]

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

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):

convert -size 100x100 xc:rgb\(0,255,0\) whatever.png
convert -size 100x100 xc:rgba\(0,255,0, 0.4\) whatever.png

Tags:

Imagemagick