![]() it never returnsĮcho "Usage: " `basename $0` " filename"Įcho " -a about - tell about us and exit"Įcho " -r=N set resolution to N (usually 72-2000)"Įcho " -f=FORMAT set format to FORMAT one of:"Įcho " jpeg, png, tiff, gif, pcx, bmp. # usage is called when we're called incorrectly. # duplicate of all things we can convert toĪlltos=`echo $ppmtos $pnmtos | tr " " "\n" | sort -u | tr "\n" " "`Ĭd "$currentdir" # Change back so we don't affect anything # back to spaces so we have a sorted list without # -u to throw away duplicates, then change newlines # list into individ line that sort can sort with # Now combine the two, change the space separated # figure out what ppms can be converted to # and remove the initial part so that we can # find all the programs starting with ppmtoxxxx OUTDIR="`dirname $examp`" #grab the directory # We found it! Use it as model to find the rest. # setformatlist - gets the list of all the things that # you can convert toĬurrentdir=`pwd` # Remember our current directoryĮxamp=`which ppmtojpeg` # find out where the progs are # exit with whatever error code they returned # various - if any of the programs we call fail, we # 45 - resolution from command line not positive numeric # 44 - unable to find conversion program for desired output # 40 - transparency not set and no default # in quiet mode exits with various return codes from # 1.1 Added checking of return codes so we could # 1.1.1 Added -a, -V and much comments changed default viewer to xdg-open ph # 1.1.1.1 Added search for default list of viewers ph # 1.1.1.2 Fixed handling of dirs and files with spaces ph # Added quiet mode "-q" (I think it works!) jk # 1.1.1.3 Changed list of Darwin viewers-Darwin doesn't have eog and evince # 1.1.1.4 Added lines to clean up png file if desired format is not png. # 1.1.1.5 Added -w option to specify white background and avoid prompt for # "Major Contributor" and added a few echoes when formats, Changed Patrick's "Johnny Come Lately" to # 1.1.1.6 Changed the call to Lilypond on OSX by defining $PATH # 1.1.1.7 Added -p flag: allows forced preview even in quiet mode. # set at command line for process to succeed. ![]() # Quiet mode is really quiet as long as sufficient parameters are # 1.1.1.8 -p flag is now necessary for preview-image is not opened in # 1.1.1.9 Added range check to getnumval ph # echoes of netpbm activity and echoes at end of process. # 1.1.1.11 Added jpg=jpeg, tif=tiff when values set at command line added # 1.1.1.12 Added final exit 0 status at end of file updated manpage It loops until it has converted each of the # 1.2 Added loop to image conversion to accommodate lilypond files that # musical examples to insert in a document or web page. ![]() # Script for making image files from lilypond source suitable for use as # It was slightly different on Mac but now I can't remember. Just put it somewhere in your manpath and make sure it has read permissions for all users. I've also attached my manpage for the script: lily2image.1. ![]() Thanks for a fun project, guys! I hope others in the Lilypond community will find it a useful tool. Thanks also to Josh Parmenter, who jumped in somewhere along the way and made very helpful suggestions, and also tested every revision I sent him. He added tons of code and gave me excellent guidance as I was learning how to script. Many, many thanks to Patrick Horgan for all of his work on this. Dependency: netpbm (available in Linux repos and MacPorts) This works equally on Mac and Linux, but not on Windows. After much revision, addition, and general fussing about with it, I'm happy to post the official version of what we're calling "lily2image," a script for converting lilypond source files to cropped image files in many different formats suitable for insertion into documents (theses, research papers, etc) or web pages.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |