lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: png cropping


From: Jonathan Kulp
Subject: Re: png cropping
Date: Thu, 18 Sep 2008 19:03:38 -0500
User-agent: Thunderbird 2.0.0.16 (X11/20080724)

Hi Patrick,

I've been running your script trying to use the command-line arguments, and something's happening with the format argument. I specify it with an argument, but then I still get prompted for format. I might not be doing the flag right. I've tried it with -f=jpeg, -f=JPEG, -fJPEG, and I think that's it. I'll copy the terminal output below so you can see. On this example I use -fGIF and while it doesn't make the script fail, it does still ask me for a format. Am I specifying the format wrong?

BTW, in the script I attached to the last email, you'll notice that with transparent background you have a choice between either png or gif--it's not forced to png. Is there a way to work this option into your version?

Jon

address@hidden:~/Documents/Composition/Guitar$ lilytoimage dc1-passage.ly -r=300 -fGIF
Resolution set to 300 dots per inch.
Transparency? y/N  n
Enter desired output format (jpeg, png, tiff, gif, pcx, bmp):  gif
GNU LilyPond 2.11.59
Processing `dc1-passage.ly'
Parsing...
Interpreting music...
Preprocessing graphical objects...
Interpreting music...
MIDI output to `dc1-passage.midi'...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Layout output to `dc1-passage.ps'...
Converting to PNG...
ppmtogif: computing colormap...
ppmtogif: 79 colors found
address@hidden:~/Documents/Composition/Guitar$


Patrick Horgan wrote:
Jonathan Kulp wrote:

I'm attaching a new version of my version of your script with that change and a new routine, getval, that validates input, you use it like:

 prompt= "Enter desired output format (jpeg, png, tiff, gif, pcx, bmp): "

 goodvals=("jpeg" "png" "tiff" "gif" "pcx" "bmp")

 getval

 FORMAT=$outval


If the user enters something that's not on the goodvals list, for example joe, it reprompts them after telling them what they might have entered:

Enter desired output format (jpeg, png, tiff, gif, pcx, bmp):  joe

Expecting one of : jpeg png tiff gif pcx bmp Enter desired output format (jpeg, png, tiff, gif, pcx, bmp):
 Cool, no?  I suppose I should add validation to the command line arguments as 
well.
Ok, just did that, resolution checked for numeric both on input and from the command line, format checked for one of the allowable things, and check to make sure there's a filename, and print meaningful error message and a usage statement. Try it and see if it works for you.
--
Jonathan Kulp
http://www.jonathankulp.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]