I am looking for a command-line tool for creating simple drawings on macOS. I usually need to draw some (very) simple figures/symbols. Drawing them with GUI apps like GIMP is somewhat an overkill, and I want to do it inside the terminal anyway.

The tool I am looking for can be a shell or a program. As an example, suppose I want to draw a "play" button (something like a flattened YouTube icon), I would expect something like an interpreter of:

color 255 0 0
rect 0 0 100 100
color 255 255 255
poly [10 10 10 90 90 50]

or a command like:

draw -c red -r 0 0 100 100 -c white -p 10 10 10 90 90 50

It is fine as long as I can draw elementary geometric shapes (lines, polygons and circles) and texts. Transparency support is a plus. Advanced features like layers are not necessary. A Linux port followed by a self-compilation is also fine. The software should be released under an open-source license.

Note: I am not looking for an obscure programming language interpreter (such as Braindraw). I also expect it to be fast, at least faster than transforming the above script into a valid Java program, then wait for compilation and run it. Also, I want a loseless output. Something like PNG or even BMP is OK. SVG isn't, though, because I need further format conversions.

Any help is appreciated.


You can use imagemagick. It has a command line tool, GUIs also available.

Drawing a rectangle can be done like this

convert logo: -fill none -stroke black -strokewidth 3 -draw "rectangle 10,10 630,470" logo_rect.png



Probably the oldest and most widely used is Graphviz Dot (search this site for questions tagged/answered thereby, for instance, this answer of mine).


graph {  
           a -- b;   
           b -- c;   
           a -- c;   
           d -- c;   
           e -- c;   
           e -- a;   

draws this:

enter image description here

For colo(u)red fill, see https://graphviz.gitlab.io/_pages/Gallery/directed/crazy.html

Look at the gallery for arrows, shapes, everything that you could wish for.

enter image description here


For 3D shapes, https://www.allwinedesigns.com/blog/stlcmd is notable.

It can draw cubes, spheres, cylinders, cones, toruses, threads (the goal was to provide a tool for 3D printing). There's a transform tool which can scale uniformly and also along any angle. Another tool will do intersections, union and differences.

The output is in STL format, http://jinjunho.github.io/Madeleine.js/ provides an open source, all JavaScript renderer for them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.