Cannot double click SVG file to resize it

I have added an SVG file (a logo) to my title page using Insert > Image from File…. The image displays and compiles fine, but I cannot double click on it to resize it. Double clicking and resizing works with other image file format.

So how can I change the size of an SVG image?

I’m using Scrivener 3.3.1 on macOS 13.4.1.

The homegrown scaling tool, which was designed purely for resizing raster images, was never modified to work with vector. What that tool changes would have no bearing on how an SVG file is sized. It wouldn’t actually be difficult to resize one manually, as XML, so I’ll add a note to look into it and see if we can integrate a simpler version of that slider control for them. This tool incidentally also does not work with PDF vector, nor is there a double-click action on it. So it’s kind of par for the course with how vector is handled in Scrivener for Mac.

Thank you, I see. So I guess the current best approach is scaling the SVG to the proper dimensions before I insert it, or editing the compile output (when it is in an editable format like ePub).

1 Like

For the first part, yes. That’s how I would go about it, and what I recommend for raster as well: import as it should be rather than using a slider that changes the DPI (which could thus go above or below the target resolution).

For just casual notes and research gathering though, sure, it doesn’t matter much if the image is 1800 DPI or 32.

I don’t know how well the second part will work however for SVG, though. Since Scrivener’s vector support is entirely based on how the system handles it, and we’re rather limited there by other concepts, such as how internally Scrivener is an RTF processor, and vector files don’t mesh well with that format. In short, it will let you place it, but any functional output of it will be rasterised, again same as PDF.

An alternative is to use Scrivener’s Markdown support, which does support both .pdf and .svg vector as source and as output. With Pandoc installed, you will gain access to its Pandoc → ePub integration.

(Note that such does not require one to author in Markdown directly, though that is certainly the main use for such integration, there is also a rich text conversion routine which is good for basic formatting, though beyond the basics it does depend upon styled source to transmit intention to HTML/CSS somehow, as Markdown is of course a plain-text format.)

Oops, thank you for the heads up! I hadn’t noticed! I’m postprocessing my epub with Sigil, so will simply insert the SVG there.

Oh! I meant to update, I was thinking about it and it should be possible to basically add everything you need as raw HTML at the point where the image should be placed—so it’s ready to roll once you import the .svg file(s) into the .epub via Sigil, making post-compile a much simpler process of just doing that part. It’s the same advice we’d give to someone wanting to place audio content, or a complex HTML structure the editor doesn’t support directly, like two divs meant to be side-by side via CSS.

In case you don’t know how to pass-thru raw HTML: the stock “Ebook” compile format has a passive style in its settings called “Raw HTML Block”, meant to be a paragraph style (there is also a “Raw HTML” character style set up for inline stuff). Create a style of that same name in your project and apply it to any text that should be injected into the final .xhtml file verbatim. If you don’t use the “Ebook” format, you can just take a quick look at its Styles compile format pane to see how it is set up; it’s a single checkbox. Easy.

In theory you could probably even inject the entire SVG XML into the .xhtml file? I actually don’t know if that is supported or wise to do (given it would greatly bloat the .xhtml file sizes). You almost certainly do not want pages upon pages of raw XML in your text editor between actual text of course (normally anyway; maybe for a title page it’s fine), so I’d suggest making use of Scrivener’s inclusion placeholder in most cases. You can read about it in the user manual PDF, under §10.1.5, Including Text From Other Documents. I.e. drop a file into the “research” folder or wherever that contains the raw XML as text, including any containing HTML and CDATA or other techniques required to make this work, style it with the aforementioned pass-thru style, and then use <$include:svgFileName> in the main text item in the draft folder to place it where it should go.

Maybe worth testing anyway, as that approach would mean zero Sigil work. You did mention this was just a logo right? It could be it’s no big deal one way or another. If we were talking hundreds of illustrations, it might be another matter, and something more complex like the above ideas would be a massive time saver.

Thank you, Amber, I really appreciate your update! Those are very helpful ideas and I’ll experiment and find out which one fits my workflow best.