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

/Henrik


Den lör 22 juli 2023 kl 10:13 skrev Ihor Radchenko <yantar92@posteo.net>:
Jonathan Gregory <jgrg@autistici.org> writes:

> On 21 Jul 2023, Ihor Radchenko wrote:
>
>> The png is still a full page on my side.
>
> That's not what I get. You're probably missing the paper settings:
>
> #+begin_src lilypond :exports none
> \version "2.20"
> \paper {
>   indent=0\mm
>   tagline=""
>   line-width=170\mm
>   oddFooterMarkup=##f
>   oddHeaderMarkup=##f
>   bookTitleMarkup=##f
>   scoreTitleMarkup=##f
> }
> #+end_src

I feel confused. Isn't you patch aiming for auto-sizing the resulting
page to fit the music fragment?

>> Also, I am getting
>>
>> Processing `/tmp/babel-xQweBZ/lilypond-WGdEvi'
>> Parsing...
>> /tmp/babel-xQweBZ/lilypond-WGdEvi:1: warning: no \version
>> statement found, please add
>>
>> \version "2.24.0"
>>
>> which does not look necessary.
>
> What is not necessary? The warning is expected. Other than that
> everything looks fine.

I guess I do not fully understand what your patch is trying to achieve.
I thought that the patch would make it not necessary to write some extra
boilerplate code, like \version or specifying the page size.

--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>