lilypond-user
[Top][All Lists]
Advanced

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

Re: setting --png in an .ly file (without using command line)?


From: Jonathan Kulp
Subject: Re: setting --png in an .ly file (without using command line)?
Date: Sat, 27 Sep 2008 16:26:03 -0500
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

Well, I'm not sure if this will do exactly what you want, but you might be able to tweak it where it will. Patrick Horgan has been helping me write a program that converts lilypond files into image files (many formats supported), and I think I'm ready to share it with the userlist again. One of its key functions is cropping images to remove all the excess white space if you want to put the images into a web page or document or something like that. If you don't want it cropped, though, you can probably just comment out the relevant lines in the script. With this tool, your command can be as simple as this:

lily2image -q filename.ly

The -q flag (quiet mode) makes it default to png format at 150 DPI resolution. You can specify different formats (gif, jpeg, tiff, pcx, bmp, and many others) and resolutions (pretty much any res you want) with -f and -r flags, and you can even make it have a transparent background. It relies on the "netpbm" package of image tools, which you can get from Linux repositories, or from MacPorts if you're a Mac user. This script runs equally well on Linux or Mac OSX.

I'll attach the script and the html version of the manpage.

Jon

Mark Polesky wrote:
When I want .png output, I usually type something like this
in the command line:

lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts
--png my_file.ly

Is it possible to do all of this from inside the .ly file?
Using the ly:set-option command, I can do most of it:

#(ly:set-option 'backend 'eps)
#(ly:set-option 'gs-load-fonts #f)
#(ly:set-option 'include-eps-fonts #t)

But I can't figure out how to set --png from within the file.
Can I?

Thanks,
Mark




_______________________________________________
lilypond-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user


--
Jonathan Kulp
http://www.jonathankulp.com

Attachment: lily2image
Description: Text document

Content-type: text/html

lily2image

Section: Lilypond Helper Tools (1)
Updated: 1.2
Index Return to Main Contents
 

NAME

lily2image - Convert lilypond source files into cropped musical examples in a variety of image formats.  

SYNTAX

lily2image [option] [option] <filename.ly>
 

DESCRIPTION

This program is designed to use Lilypond source files to create musical examples suitable for insertion in documents and web pages. It requires the netpbm package of image-manipulation tools and supports a large variety of image formats. Without options, it gathers user preferences interactively to set the following parameters: resolution, background transparency, and desired output format.  

OPTIONS

-r=<res>, --resolution=<res>
Set resolution to DPI specified by numeric value.
-f=<frmt>, --format=<frmt>
Set desired image format. For a full list of supported formats, see manpages for the pnmto<format> and ppmto<format> tools from netpbm.
-q, --quiet
All echo messages are suppressed and terminal is silent throughout conversion process. If any parameters are not set at command line, program assumes defaults (-f=png, -r=150). If any errors occur, check return status for error codes.
-p
Preview. Display converted image in default image viewer, or in user-specified viewer if set with -V.
-t, --transparency
Set background to transparent (without this option background is white). Only png and gif formats support transparent background.
-a, --about
Output program information end exit.
-u
Output usage information and exit.
-v
Output version information and exit.
-V=<viewer>
Specify image viewer. Options are "evince", eye of gnome ("eog"), and "gwenview" in Linux; "preview" in OSX.
 

EXAMPLES

Since no options are set, this example will run the program in interactive mode:


     lily2image filename.ly

You may specify options at the command line. The following example creates a gif image with transparent background at a resolution of 300 dpi:


     lily2image -r=300 -f=gif -t filename.ly

The next example converts to png. Since resolution is not set, user will be prompted to enter resolution value:


     lily2image -f=png filename.ly

In this example, the resolution is still not set, but user will NOT be prompted to enter resolution value because quiet mode is specified. Resolution will be the default 150 DPI:


     lily2image -f=png -q filename.ly

The last example will produce a gif image at 250 DPI with transparent background. It will run in quiet mode (suppressing all echo messages) but will display image in Evince viewer when finished since the -p option is set and Evince is selected:


     lily2image -f=gif -r=250 -t -q -p -V=evince filename.ly  

EXIT STATUS

In quiet mode, program exits with various return codes.

0
Conversion successful.
40
Transparency not set and no default.
41
Format not set and no default.
42
Resolution not set and no default.
43
Netpbm utilities not installed.
44
Unable to find conversion program for desired output.
45
Resolution from command line not positive numeric.
46
Format from command line invalid

 

AUTHORS

Jonathan Kulp, Patrick Horgan.  

SEE ALSO

netpbm, lilypond.


 

Index

NAME
SYNTAX
DESCRIPTION
OPTIONS
EXAMPLES
EXIT STATUS
AUTHORS
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 21:24:37 GMT, September 27, 2008
reply via email to

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