generating pdf and png but no ps

2008-10-03 Thread Sebastian Menge
Hi

How can I generate pdf and png but no ps?

Can I adjust resolution of the png? I just need thumbnails.

Is there a simple way to see (e.g. from the shell or an external
programming language) how many png-pages lilypond produced?

Thanks, Sebastian.


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: generating pdf and png but no ps

2008-10-03 Thread Tim Slattery
Sebastian Menge <[EMAIL PROTECTED]> wrote:

>Hi
>
>How can I generate pdf and png but no ps?

AFAIK, you can't. My understanding is that Lilypond generates the *.ps
first, then converts that to *.pdf. You could write a script that
invokes the program then deletes the *.ps file.

-- 
Tim Slattery
[EMAIL PROTECTED]
http://members.cox.net/slatteryt



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: generating pdf and png but no ps

2008-10-03 Thread Gilles Sadowski
Hi.

> How can I generate pdf and png but no ps?

$ lilypond file.ly
GNU LilyPond 2.10.33
Processing `file.ly'
Parsing...
Interpreting music... [2]
Preprocessing graphical objects...
Layout output to `file.ps'...
Converting to `file.pdf'...
$ rm file.ps

> Can I adjust resolution of the png? I just need thumbnails.

$ convert file.png -resize 120 file_resized.png

> Is there a simple way to see (e.g. from the shell or an external
> programming language) how many png-pages lilypond produced?

?

Best,
Gilles


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: generating pdf and png but no ps

2008-10-03 Thread Dmytro O. Redchuk
2008/10/3 Gilles Sadowski <[EMAIL PROTECTED]>:
> Hi.

>> Can I adjust resolution of the png? I just need thumbnails.
>
> $ convert file.png -resize 120 file_resized.png
Probably, lilypond -dresolution can help, too.

>> Is there a simple way to see (e.g. from the shell or an external
>> programming language) how many png-pages lilypond produced?

?

>
> Best,
> Gilles

-- 
Dmytro O. Redchuk


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: generating pdf and png but no ps

2008-10-03 Thread Sebastian Menge
Am Fri, 3 Oct 2008 14:38:39 +0200
schrieb Sebastian Menge <[EMAIL PROTECTED]>:

> How can I generate pdf and png but no ps?
> 
> Can I adjust resolution of the png? I just need thumbnails.
> 
> Is there a simple way to see (e.g. from the shell or an external
> programming language) how many png-pages lilypond produced?

Ok, to clarify this a bit:

I'm invoking lilypond from a php-application and want to reduce the
number of shell commands as far as possible. I also dont want to tidy
up any mess that is generated but not needed. I just want the most
elegant way to generate a pdf and some thumbs to offer it on a web page.

And I know 'rm' and 'imagemagick' :-)

But it seems I need to write a wrapper for that.

Seb.


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: generating pdf and png but no ps

2008-10-03 Thread Sebastian Menge
Am Fri, 3 Oct 2008 16:31:08 +0300
schrieb "Dmytro O. Redchuk" <[EMAIL PROTECTED]>:

> 2008/10/3 Gilles Sadowski <[EMAIL PROTECTED]>:
> > Hi.
> 
> >> Can I adjust resolution of the png? I just need thumbnails.
> >
> > $ convert file.png -resize 120 file_resized.png
> Probably, lilypond -dresolution can help, too.
> 
> >> Is there a simple way to see (e.g. from the shell or an external
> >> programming language) how many png-pages lilypond produced?

--png produces file-page1.png file-page2.png etc.

I dont know how many pages there are, but I want a thumbnail in a
html page for "each". So I have to make a loop to generate 
and 's. But for the loop I need the number of pages, I think.

Any other ideas are aprreciated.

Seb.



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: generating pdf and png but no ps

2008-10-03 Thread Gilles THIBAULT



How can I generate pdf and png but no ps?
Try 
   #(ly:set-option 'delete-intermediate-files #t)


Gilles


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: generating pdf and png but no ps

2008-10-03 Thread Sebastian Menge
Am Fri, 3 Oct 2008 15:56:05 +0200
schrieb "Gilles THIBAULT" <[EMAIL PROTECTED]>:

> > How can I generate pdf and png but no ps?
> Try 
> #(ly:set-option 'delete-intermediate-files #t)

Yeah. that's exactly what I was looking for:

  lilypond -d delete-intermediate-files=#t test.ly

does the job.

Thanks alot, Seb.


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: generating pdf and png but no ps

2008-10-03 Thread Alexander Kobel
Sebastian Menge wrote:
> How can I generate pdf and png but no ps?
AFAIK for what you want, no; LilyPond needs the PS for PDF output.
IIRC, recently there was a discussion about implementing a switch to
automatically delete the intermediate PS, but currently there is none.
So you'll have to call a rm yourself. (Which does not harm too much;
it's not that rm generates much traffic even for a very restricted and
low-powered PHP server, is it?)

Wohoo. Just saw Gilles' mail; I think there's some possibility to call
the scheme command from the commandline, too, but you seem to need a
guile-user thingie... Not sure if this really helps, then. See the first
paragraph here:
http://lilypond.org/doc/v2.11/Documentation/user/lilypond-program/Command-line-options-for-lilypond#Command-line-options-for-lilypond

> Can I adjust resolution of the png? I just need thumbnails.
Grep for dresolution here:
http://lilypond.org/doc/v2.11/Documentation/user/lilypond-program/Command-line-options-for-lilypond#Command-line-options-for-lilypond
But: You may end up faster generating the PDF (which you seem to need
anyway) and use convert (ImageMagick) or gs or something to get the PNG;
you won't need a second engraving run then. (Is it possible to use --png
and --pdf output in Lily simultaneously? Never bothered...)

> Is there a simple way to see (e.g. from the shell or an external
> programming language) how many png-pages lilypond produced?
Well, three things come into my mind.

> --png produces file-page1.png file-page2.png etc.
First, quick 'n' dirty:
ls -1 "file-page*.png" | wc -l
(This is the digit one after ls (one entry per line), and the letter L
after wc (count lines).)
Make sure there's nothing else matching to the filename pattern.
Otherwise you could do a bash loop and count until there's no file of
the expected name... Or try something like
ls -1 | grep -E 'file-page[0-9]+\.png' | wc -l

But, since you generate the pdf anyway:
Second, using pdfinfo (which I'm not sure where it comes from, but it
seems to be standard. Maybe xpdf?):
pdfinfo file.pdf | grep "Pages:"
and remove the "Pages:\t" in your script.

Third, same idea, and yet another advertising for the great pdftk
(http://www.accesspdf.com/pdftk/):
pdftk file.pdf dump_data | grep "NumberOfPages:"
and remove the "NumberOfPages: " in your script.


HTH
Alexander


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: generating pdf and png but no ps

2008-10-03 Thread Jonathan Kulp

Sebastian,

Your situation is perfectly suited for the script that Patrick Horgan 
and I wrote.  Now, the script also crops the extra white space off, so 
you might need to edit the script a bit if you don't want the margins 
cropped off. Just look for the part in the loop that uses pnmcrop.  It 
handles multipage files just fine, and it cleans up .ps files as part of 
the process.  It's very easy to set the resolution and output format 
(png is default, but it also supports many other formats).  Your command 
looks like this for a png output at 72 DPI:


lily2image -r=72 -f=png filename.ly

You can also make a transparent background if you want, and you can set 
it to preview the converted files in your default image viewer with a -p 
 flag.


The only dependency is the netpbm package, easily obtained from most 
linux repositories I would guess.


Script and manpage are attached.

Jonathan

Sebastian Menge wrote:

Am Fri, 3 Oct 2008 14:38:39 +0200
schrieb Sebastian Menge <[EMAIL PROTECTED]>:


How can I generate pdf and png but no ps?

Can I adjust resolution of the png? I just need thumbnails.

Is there a simple way to see (e.g. from the shell or an external
programming language) how many png-pages lilypond produced?


Ok, to clarify this a bit:

I'm invoking lilypond from a php-application and want to reduce the
number of shell commands as far as possible. I also dont want to tidy
up any mess that is generated but not needed. I just want the most
elegant way to generate a pdf and some thumbs to offer it on a web page.

And I know 'rm' and 'imagemagick' :-)

But it seems I need to write a wrapper for that.

Seb.


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user



--
Jonathan Kulp
http://www.jonathankulp.com
.TH "lily2image" "1" "1.2" "Jonathan Kulp, Patrick Horgan" "Lilypond Helper 
Tools"
.SH "NAME"
.LP 
lily2image \- Convert lilypond source files into cropped musical examples in a 
variety of image formats.
.SH "SYNTAX"
.LP 
lily2image [\fIoption\fP] [\fIoption\fP] <\fIfilename.ly\fP>
.br 
.SH "DESCRIPTION"
.LP 
This program is designed to use Lilypond source files to create musical 
examples suitable for insertion in documents and web pages.  It requires the 
\fBnetpbm\fR 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. 
.SH "OPTIONS"
.LP 
.TP 
\fB\-r=, \-\-resolution=\fR
Set resolution to DPI specified by numeric value.
.TP 
\fB\-f=, \-\-format=\fR
Set desired image format.  For a full list of supported formats, see manpages 
for the pnmto and ppmto tools from \fBnetpbm\fR.
.TP 
\fB\-q, \-\-quiet\fR
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.
.TP 
\fB\-p\fR
Preview. Display converted image in default image viewer, or in user\-specified 
viewer if set with \-V.
.TP 
\fB\-t, \-\-transparency\fR 
Set background to transparent (without this option background is white). Only 
png and gif formats support transparent background.
.TP 
\fB\-a, \-\-about\fR
Output program information end exit. 
.TP 
\fB\-u\fR
Output usage information and exit.
.TP 
\fB\-v\fR
Output version information and exit.
.TP 
\fB\-V=\fR
Specify image viewer. Options are "evince", eye of gnome ("eog"), and 
"gwenview" in Linux; "preview" in OSX.
.TP 
.SH "EXAMPLES"
.LP 
Since no options are set, this example will run the program in interactive mode:
.LP 
 lily2image filename.ly
.LP 
You may specify options at the command line. The following example creates a 
gif image with transparent background at a resolution of 300 dpi:
.LP 
 lily2image \-r=300 \-f=gif \-t filename.ly
.LP 
The next example converts to png. Since resolution is not set, user will be 
prompted to enter resolution value:
.LP 
 lily2image \-f=png filename.ly
.LP 
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:
.LP 
 lily2image \-f=png \-q filename.ly
.LP 
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:
.LP 
 lily2image \-f=gif \-r=250 \-t \-q \-p \-V=evince filename.ly
.SH "EXIT STATUS"
.LP
In quiet mode, program exits with various return codes.
.PD 0
.TP
.I 0
Conversion successful.
.TP
.I 40
Transparency not set and no default.
.TP
.I 41
Format not set and no default.
.TP
.I 42
Resolution not set and no default.
.TP
.I 43
Netpbm utilities n

Re: generating pdf and png but no ps

2008-10-03 Thread Sebastian Menge
Am Fri, 03 Oct 2008 16:13:30 +0200
schrieb Alexander Kobel <[EMAIL PROTECTED]>:

> > Is there a simple way to see (e.g. from the shell or an external
> > programming language) how many png-pages lilypond produced?
> Well, three things come into my mind.
> 
> > --png produces file-page1.png file-page2.png etc.
> First, quick 'n' dirty:
>   ls -1 "file-page*.png" | wc -l
> (This is the digit one after ls (one entry per line), and the letter L
> after wc (count lines).)
> Make sure there's nothing else matching to the filename pattern.
> Otherwise you could do a bash loop and count until there's no file of
> the expected name... Or try something like
>   ls -1 | grep -E 'file-page[0-9]+\.png' | wc -l
> 
> But, since you generate the pdf anyway:
> Second, using pdfinfo (which I'm not sure where it comes from, but it
> seems to be standard. Maybe xpdf?):
>   pdfinfo file.pdf | grep "Pages:"
> and remove the "Pages:\t" in your script.
> 
> Third, same idea, and yet another advertising for the great pdftk
> (http://www.accesspdf.com/pdftk/):
>   pdftk file.pdf dump_data | grep "NumberOfPages:"
> and remove the "NumberOfPages: " in your script.

There is no option to get similar output directly from lily?

Hmm, ok. These are enough workarounds to keep going.

And you are right, pdftk is a *great* tool (and FYI it's just a wrapper
to a java-library called iText by Bruno Lowagi. There are ports to
other languages (e.g. c#) , but i dont know about any port to
scheme :-) ) 

Thanks, S.


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: generating pdf and png but no ps

2008-10-03 Thread Alexander Kobel
Jonathan Kulp wrote:
> [...]
> Your situation is perfectly suited for the script that Patrick Horgan
> and I wrote. [...]
These are the moments when I think I should set up my own little project
where I can reinvent the wheel for all basic stuff on myself.
I'm just missing an idea what this project should be all about... ;-)


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: generating pdf and png but no ps

2008-10-03 Thread Jonathan Kulp

Are you wondering what my lily2image project is about?  Well,

1) me learning how to script (biggest reason of all, probably, since 
this started out only as something I was going to use myself and evolved 
into something much more complicated)


2) creating musical examples (by which I mean images of music notation 
to insert in a document or web page) from lilypond source that are 
cropped properly (lilypond with png output does full pages)


3) being able to choose from variety of image output formats at the same 
moment as calling lilypond rather than having to convert them later;


4) being able to specify parameters with easy-to-remember flags instead 
of long options I have to look up in the documentation every time.


I suppose you could say it's a reinvention of the wheel, but this wheel 
rides more smoothly for me :)


Jon

Alexander Kobel wrote:

Jonathan Kulp wrote:

[...]
Your situation is perfectly suited for the script that Patrick Horgan
and I wrote. [...]

These are the moments when I think I should set up my own little project
where I can reinvent the wheel for all basic stuff on myself.
I'm just missing an idea what this project should be all about... ;-)



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


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: generating pdf and png but no ps

2008-10-03 Thread Alexander Kobel
Jonathan Kulp wrote:
> [...]
> I suppose you could say it's a reinvention of the wheel, but this wheel
> rides more smoothly for me :)

I didn't dig into your script at all (although I probably will some
time); my "reinvention of the wheel" merely refers to my longish post a
few minutes before, with different approaches to problems you seem to
have already solved in a more elegant way.
Anyway, I never needed all this stuff so far; I'm perfectly fine with a
simple PDF file of nice stuff which my choir can mess up... So I'm stuck
with makefiles and a tag every now and then. My opera is yet to come... :-)

>>> [...]
>>> Your situation is perfectly suited for the script that Patrick Horgan
>>> and I wrote. [...]
>> These are the moments when I think I should set up my own little project
>> where I can reinvent the wheel for all basic stuff on myself.
>> I'm just missing an idea what this project should be all about... ;-)



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: generating pdf and png but no ps

2008-10-03 Thread Jonathan Kulp
Ah, I understand now.  That's nice of you to say...

Surely your choir would never mess anything up? :)

Jon

On Fri, Oct 3, 2008 at 11:19 AM, Alexander Kobel <[EMAIL PROTECTED]> wrote:

>
>
> I didn't dig into your script at all (although I probably will some
> time); my "reinvention of the wheel" merely refers to my longish post a
> few minutes before, with different approaches to problems you seem to
> have already solved in a more elegant way.
> Anyway, I never needed all this stuff so far; I'm perfectly fine with a
> simple PDF file of nice stuff which my choir can mess up... So I'm stuck
> with makefiles and a tag every now and then. My opera is yet to come... :-)
>
>
>

-- 
Jonathan Kulp
http://www.jonathankulp.com
___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user