Re: \epsfile and SVG output
Thanks - the idea about post-processing is particularly interesting. In the long run it would be great to be able to add SVGs directly, but I suspect that would be too big a dev job (in terms of understanding the lily pond codebase) for me to get into at the moment. Alex > On 10 Apr 2024, at 15:03, Jean Abou Samra wrote: > >> Many thanks for the clarification that this approach will not work and >> alternative suggestions. >> >> I presume that /image will only include PNGs in a SVG output and not EPS (the >> documentation reads a little unclearly on this as the section on backends is >> elided with comments on coloured backgrounds)? > > > In fact, PNG in \image works in all output formats/backends > (it is only if you want transparency that it has limitations, > but the default is to add a white background, so there is no > limitation in the default settings). > > >> For context I am using SVG output because my display target is a custom IOS >> app that uses skia as a backend. SKIA can be used to display SVGs easily >> within the context that I am working. SKIA does have a pdf backend but it >> isn’t exposed directly by the framework I’m using. >> >> The reason to use EPS is that I want to bring in vector graphics made in >> Inkscape using a graphics tablet. It is a little frustrating that I can’t get >> these vector graphics into Lilypond SVG output, as they are basically SVG in >> the first place, but from what I understand so far that isn’t possible. > > > Yes, unfortunately the SVG backend isn't as well-developed as the > other backends and in particular doesn't support including SVG > (which it could easily do). The Cairo backend also supports outputting > SVG, but doesn't support including SVG either. > > >> Therefore, if I understand correctly my current options would be: >> >> - render to pdf and work on a system to render pdfs within the framework I’m >> using (this is probably possible, but involves lots of unknowns) >> - rasterise the images and display as PNG, thus include the rasterised >> version >> in the SVG (not optimal in terms of file size or speed of render, but >> possible) >> - work on a system to convert SVG paths to Lilypond/Scheme paths in order to >> be able to draw in a vector within Lilypond to any backend. > > > That sounds right. Alternatively, you might be able to add a tag > with a specific id using the output-attributes property, then post-process > the file to replace the tag with that id with your custom content or > something like that. >
Re: \epsfile and SVG output
Am 10.04.24 um 15:50 schrieb Alex Harker: Many thanks for the clarification that this approach will not work and alternative suggestions. I presume that /image will only include PNGs in a SVG output and not EPS (the documentation reads a little unclearly on this as the section on backends is elided with comments on coloured backgrounds)? For context I am using SVG output because my display target is a custom IOS app that uses skia as a backend. SKIA can be used to display SVGs easily within the context that I am working. SKIA does have a pdf backend but it isn’t exposed directly by the framework I’m using. The reason to use EPS is that I want to bring in vector graphics made in Inkscape using a graphics tablet. It is a little frustrating that I can’t get these vector graphics into Lilypond SVG output, as they are basically SVG in the first place, but from what I understand so far that isn’t possible. Therefore, if I understand correctly my current options would be: - render to pdf and work on a system to render pdfs within the framework I’m using (this is probably possible, but involves lots of unknowns) - rasterise the images and display as PNG, thus include the rasterised version in the SVG (not optimal in terms of file size or speed of render, but possible) - work on a system to convert SVG paths to Lilypond/Scheme paths in order to be able to draw in a vector within Lilypond to any backend. * * Have I missed anything? Maybe include EPS, use LiyPond’s PDF backend and convert PDF to SVG with Inkscape? Hraban
Re: \epsfile and SVG output
> Many thanks for the clarification that this approach will not work and > alternative suggestions. > > I presume that /image will only include PNGs in a SVG output and not EPS (the > documentation reads a little unclearly on this as the section on backends is > elided with comments on coloured backgrounds)? In fact, PNG in \image works in all output formats/backends (it is only if you want transparency that it has limitations, but the default is to add a white background, so there is no limitation in the default settings). > For context I am using SVG output because my display target is a custom IOS > app that uses skia as a backend. SKIA can be used to display SVGs easily > within the context that I am working. SKIA does have a pdf backend but it > isn’t exposed directly by the framework I’m using. > > The reason to use EPS is that I want to bring in vector graphics made in > Inkscape using a graphics tablet. It is a little frustrating that I can’t get > these vector graphics into Lilypond SVG output, as they are basically SVG in > the first place, but from what I understand so far that isn’t possible. Yes, unfortunately the SVG backend isn't as well-developed as the other backends and in particular doesn't support including SVG (which it could easily do). The Cairo backend also supports outputting SVG, but doesn't support including SVG either. > Therefore, if I understand correctly my current options would be: > > - render to pdf and work on a system to render pdfs within the framework I’m > using (this is probably possible, but involves lots of unknowns) > - rasterise the images and display as PNG, thus include the rasterised version > in the SVG (not optimal in terms of file size or speed of render, but > possible) > - work on a system to convert SVG paths to Lilypond/Scheme paths in order to > be able to draw in a vector within Lilypond to any backend. That sounds right. Alternatively, you might be able to add a tag with a specific id using the output-attributes property, then post-process the file to replace the tag with that id with your custom content or something like that. signature.asc Description: This is a digitally signed message part
Re: \epsfile and SVG output
Many thanks for the clarification that this approach will not work and alternative suggestions. I presume that /image will only include PNGs in a SVG output and not EPS (the documentation reads a little unclearly on this as the section on backends is elided with comments on coloured backgrounds)? For context I am using SVG output because my display target is a custom IOS app that uses skia as a backend. SKIA can be used to display SVGs easily within the context that I am working. SKIA does have a pdf backend but it isn’t exposed directly by the framework I’m using. The reason to use EPS is that I want to bring in vector graphics made in Inkscape using a graphics tablet. It is a little frustrating that I can’t get these vector graphics into Lilypond SVG output, as they are basically SVG in the first place, but from what I understand so far that isn’t possible. Therefore, if I understand correctly my current options would be: - render to pdf and work on a system to render pdfs within the framework I’m using (this is probably possible, but involves lots of unknowns) - rasterise the images and display as PNG, thus include the rasterised version in the SVG (not optimal in terms of file size or speed of render, but possible) - work on a system to convert SVG paths to Lilypond/Scheme paths in order to be able to draw in a vector within Lilypond to any backend. Have I missed anything? Alex > On 10 Apr 2024, at 12:33, Jean Abou Samra wrote: > >> An alternative, if you can use raster graphics, would be a PNG file added >> with the \image command. > > > P.S. \image is new in 2.25 > https://lilypond.org/doc/v2.25/Documentation/notation/graphical-markup > (and I remember now that I wrote down what does and doesn't > support EPS in the 2.25 documentation, in the description of \image)
Re: \epsfile and SVG output
Am 10.04.24 um 14:31 schrieb Jean Abou Samra: It would be possible to convert EPS to SVG with pstoedit or via PDF and Inkscape. Both would avoid rastering vectors into a pixel image. True, but LilyPond so far doesn't support including SVG images either. (It does support \markup \path in SVG though.) Ah, I didn’t know. Hraban
Re: \epsfile and SVG output
> It would be possible to convert EPS to SVG with pstoedit or via PDF and > Inkscape. Both would avoid rastering vectors into a pixel image. True, but LilyPond so far doesn't support including SVG images either. (It does support \markup \path in SVG though.) signature.asc Description: This is a digitally signed message part
Re: \epsfile and SVG output
Am 10.04.24 um 13:29 schrieb Jean Abou Samra: I am trying to include an epsfile as a top-level markup (it is not in a score) and then output as SVG. You can't (this should indeed be mentioned in the documentation). EPS files are included by basically inlining them into the PS code that LilyPond generates, which is then converted to PDF. In the SVG backend, LilyPond generates SVG code directly and skips \epsfile markups. The Cairo backend is yet another beast but it doesn't support outputting \epsfile other than in PS/EPS output. An alternative, if you can use raster graphics, would be a PNG file added with the \image command. It would be possible to convert EPS to SVG with pstoedit or via PDF and Inkscape. Both would avoid rastering vectors into a pixel image. Hraban
Re: \epsfile and SVG output
> An alternative, if you can use raster graphics, would be a PNG file added > with the \image command. P.S. \image is new in 2.25 https://lilypond.org/doc/v2.25/Documentation/notation/graphical-markup (and I remember now that I wrote down what does and doesn't support EPS in the 2.25 documentation, in the description of \image) signature.asc Description: This is a digitally signed message part
Re: \epsfile and SVG output
> I am trying to include an epsfile as a top-level markup (it is not in > a score) and then output as SVG. You can't (this should indeed be mentioned in the documentation). EPS files are included by basically inlining them into the PS code that LilyPond generates, which is then converted to PDF. In the SVG backend, LilyPond generates SVG code directly and skips \epsfile markups. The Cairo backend is yet another beast but it doesn't support outputting \epsfile other than in PS/EPS output. An alternative, if you can use raster graphics, would be a PNG file added with the \image command. HTH Jean signature.asc Description: This is a digitally signed message part