One option is to use the 'chop' option with 'convert' from the command line - details.
Another option is to use shave.
Note that in both cases you will probably have to make 2 images, left and right piece, and then merge them together with something like the 'append' option (details).
For actual command line scripts, look here.