Skip to content

Instantly share code, notes, and snippets.

@morrxy
Last active March 14, 2018 01:19
Show Gist options
  • Save morrxy/f4209db743f14782f98162b833bf394e to your computer and use it in GitHub Desktop.
Save morrxy/f4209db743f14782f98162b833bf394e to your computer and use it in GitHub Desktop.
[create image in cli] #shell

https://stackoverflow.com/questions/12499728/create-png-jpg-file-with-commandline-on-mac

The command-line convert utility in the ImageMagick suite can easily create an image of specified dimensions:

convert -size 200x200 xc:white canvas.png

To create an image with text, use additional options:

convert -size 200x200 -gravity center -background white -fill black \
    label:"text goes here" canvas.png

The ImageMagick site has many more examples of usage.

To get ImageMagick on OSX, you can either use an automated build system such as MacPorts or run a pre-made installer package.

convert -size 100x100 gradient:blue logo.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment