Den tis 25 juli 2023 kl 18:16 skrev Henrik Frisk <frisk.h@gmail.com>:
Hi,

I have been struggling with the same issues to but have completely missed this thread. I haven't tried the patch of ob-lilypond but testing the file https://git.sr.ht/~bzg/worg/tree/6f69d212f41bc372426dc9b4df286638fe8f2a92/item/org-contrib/babel/examples/lilypond.org I'm getting cropped output with pdf, but not png (generates full page). Also, omitting the paper stuff I still get the same cropped output wit pdf:

#+begin_src lilypond :file ionian.png
 \version "2.24.1"
    \relative c' {
      c d e f
      g a b c
      b a g f
      e d c d
      e f g a
      b c b a
      g f e d
      c1
    }
#+end_src

Adding  #(ly:set-option 'crop #t) to the file gives a cropped output in the file 'ionian.cropped.png' but the ionian.png is still fullpage. I was looking in ob-lilypond to change the outputfile name but the easy solution is to just give the cropped name as the :file argument:

:file ionian.cropped.png

Then the file is shown inline in the #+RESULT: block. This works for other file formats two, like pdf and eps.

Here's a short version:

#+begin_src lilypond :file ionian.cropped.png
  \Version "2.24.1"
    #(ly:set-option 'crop #t)
    \relative c' {
      c d e f
    }
#+end_src

My bad, putting :file ionian.cropped.png only results in ionian.cropped.cropped.png (as expected). Unclear why it worked the first couple of times.

/Henrik