Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create blank image in Imagemagick

Tags:

imagemagick

How to create a blank new image in Imagemagick via command line?

Using -background doesn't work:

$ convert -size 800x800 -background white x.png convert: no images defined `x.png' @ error/convert.c/ConvertImageCommand/3257. 
like image 227
qubodup Avatar asked Sep 15 '16 06:09

qubodup


1 Answers

White background

convert -size 800x800 xc:white white.png 

xc: used to mean "X Constant Image" but now is just a shorthand for canvas:. This means you can also use:

convert -size 800x800 canvas:white white.png 

and because "white" is the default value if no color is provided, you can also use:

convert -size 800x800 xc: white.png convert -size 800x800 canvas: white.png 

Transparent background

If by "blank" you mean "transparent", just use that word as the color:

convert -size 800x800 xc:transparent transparent.png 

Answer made possible by ImageMagick v6 Examples and How to create a new image?

like image 91
qubodup Avatar answered Nov 13 '22 01:11

qubodup