Just some personal notes, or a cheatsheet, on using Inkscape.
Note for other people: I usually use Inkscape and Emacs in conjunction, and I’ve made my own (as-of-yet undocumented) library called jmm-inkscape.el
for using them together.
It basically relies on D-Bus communication, though Inkscape’s D-Bus interface recently was updated.
Some of the org.gtk.Actions
for Inkscape are located in src/actions/
.
Like here’s an example of actions defined in actions-selection.cpp
.
Links
- Inkscape’s official website is inkscape.org.
- Issues are tracked at gitlab.com/inkscape/inkscape/.
- A keyboard and mouse reference is at inkscape.org/doc/keys.html.
Some unofficial links I find useful.
- Logos by Nick has pretty good Inkscape tutorials. See Logos by Nick’s YouTube channel or his website, logosbynick.com.
- Learning how SVG works under the hood really helps with using Inkscape. Check out MDN’s reference on SVG for more about that.
- Tavmjong Bah has some good (but sometimes outdated) references on his site at http://tavmjong.free.fr/blog/.
Command line
See https://wiki.inkscape.org/wiki/Using_the_Command_Line.
Exporting a PNG
Here’s how you’d export a PNG with a white background and a width of 500px.
inkscape yourfile.svg --export-type=png --export-width=500 --export-background=white
It’ll make a file named yourfile.png by default.
SVG to PDF
Here’s how you’d export an SVG to a PDF:
inkscape --export-type=pdf --export-filename=output.pdf input.svg
Note the --export-type=pdf
isn’t actually necessary, but I think it ensures that the export-filename
has the right extension.
Tips
Editing defs or markers
Editing markers or symbols (which are in the <defs>
section) can be slightly annoying.
One tip is to replace a def’d ID with a <use>
element pointing to some group (e.g. <g>
), which you can then edit.
You may also be able to have the <use>
point to an external SVG.
(TODO: Show an example of this.)
Issues
Some issues I’ve run into with Inkscape:
-
For some reason, trying to export SVGs in Inkscape 1.2.1 with NixOS 22.11 in GNOME causes Inkscape to crash. What’s weirder is that it actually does successfully export a PNG, but seemingly crashes after that. This seems to happen with GNOME specifically, and not when I’m running under Sway.
The error looks like the following:
Emergency save activated! Emergency save completed. Inkscape will close now. If you can reproduce this crash, please file a bug at https://inkscape.org/report with a detailed description of the steps leading to the crash, so we can fix it. ** Message: 12:00:00.000: Error: Inkscape encountered an internal error and will close now.
(This error was seen on 2023-09-18)
-
Inkscape can take sometimes hang on startup for me. I think this was caused by Inkscape trying to load previews of all installed fonts. This issue is tracked at https://gitlab.com/inkscape/inkscape/-/issues/841.
I think the workaround I used for it was to close a fonts dialog, or maybe there was another preference I set so it doesn’t try to preview fonts.