[Top][All Lists]

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

creating images for web pages

From: ed stuckems
Subject: creating images for web pages
Date: Sun, 7 Aug 2011 13:16:11 -0400


I'm trying to create images of lilypond output to be included in web
pages.  I've been able to do it but the process is extremely labour
intensive and I've got to believe there's a more efficient way.  Can
someone please comment on ways to improve my process or suggest a
different strategy?

Here's what I do currently:

(1) generate the typeset music for an 8.5in x 11in page to get an idea
of the size of the resulting typeset music (currently, the music is
typically one or two measures long and consists of about a dozen

(2) Add a \paper{ ... } block to the source file to redefine the page
size to be the smallest page size to fit the typeset music.  This is a
trial-and-error method where I fiddle with the page size parameters
until I get an image with the an acceptable amount of white space
around the image.  Here's an example showing the parameters I use:

  paper-width = 7\cm
  paper-height = 2.54\cm
  top-margin = 0\mm
  page-top-space = 0\mm
  left-margin = 0\mm
  line-width = 7\cm

Any parameters not present (eg bottom-margin) were removed because
brute-force tests showed they didn't impact on the size of the paper.

(4) Add a header block to remove lilypond's default tag line

(5) Regenerate the typeset music which produces a ps and pdf file of
the correct size (typically about 3in to 4in wide by 1in high)

(6) use ghostscript to convert the pdf/ps file to a bmp file with the
following command line:

gs -sDEVICE=bmpmono -r300 -dGraphicsAlphaBits=4 -o filename.bmp

(7) The End; the resulting file, filename.bmp, is now included in a web page.

The most time consuming part of the process are figuring out the size
of the typeset image.  If lilypond can be coerced into producing the
dimensions then that would save me considerable time.

Of course, my problems here are that I don't grok lilypond, scheme, or
ghostscipt enough to know any better method than the brute force
method I've described above.  Any help will be greatly appreciated.


reply via email to

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