d9p is a command-line version of [draw9patch] utility from Android SDK.
d9p is written in Go language, so you will need Go compiler. Then, you can run
'make' to compile the sources. The binary you will get, d9p, is a standalone
ready-to-use application. You can put it to /usr/local/bin or whereever you
d9p requires two arguments: input file in PNG format and output file name.
Also, you can pass options to specify nine-patch boundaries.
Each boundary is specified with two numbers, separated by colon.
d9p -l 10:23 -t 11:11 in.png out.9.png # will draw a left boundary from 10 to
# 23 pixels inclusively, and a top
# boundary (a single pixel)
If you use vector graphics editor (e.g Inkscape), you can use it to create
hdpi/mdpi/ldpi images of various sizes, and then draw patches with d9p tool
like in the example above.
You can also use inotify-tools to run d9p automatically when the original file