There is a music notation program called Lilypond which includes a command line interface and a command line midi2ly converter that will read in a midi file and output a lilypond file.
- Should work on linux Yes and OS/X, Windows
- Should be able to run in terminal Yes or GUI for the main program
- Should be able to save the music sheet in a image format: jpeg or png Yes By default saves as both pdf and poscript format but you can specify
-fpng for png format or
-dbackend=svg for svg format
- Price: Free - Gratis & Open Source GNU GPL
The output of Lilipond is very high quality and the input files, (output from midi2ly), are text files that can easily be tweaked as needed.
While I haven't tested it you should be able to use:
midi2ly somefile.md | lilypond --pdf - -o somefile
There are a couple of known shortcomings of midi2ly especially when converting midi files that have been recorded by someone playing on a keyboard.