Inkscape DXF to SVG on Linux and Windows Command line solution

Ellery Leung
2 min readDec 22, 2021

--

Assume that I am converting truelove5.dxf to truelove5.svg in an A4 size canva. Here is how to do under Windows/Linux:

Window:

Notes:

  • Use the python version inside inkscape (bin\python.exe)
  • Use dxf_input.py in C:\Program Files (x86)\inkscape\share\inkscape\extensions\. You can open this .py file directly in your text editor to see how it works inside.
  • Use--scalemethod=auto to do autoscale.

Assume that my main inkscape program is installed in C:\Program Files (x86)\inkscape\, inside this directory, execute:

bin\python.exe share\inkscape\extensions\dxf_input.py c:\Users\myuser\truelove5.dxf --output=c:\Users\myuser\truelove5.svg --scalemethod=auto

You should be able to open this new svg file in a browser just by doubleclick it.

Linux:

Notes:

Steps:

  • Download the AppImage in main Inkscape site (https://inkscape.org/release/inkscape-1.1.1/gnulinux/)
  • Upload to your linux server, and make it executable: chmod +x <your_.AppImage_file>.
  • As of this writing, my file name is Inkscape-3bf5ae0-x86_64.AppImage, so I run chmod +x Inkscape-3bf5ae0-x86_64.AppImage
  • Run this: ./Inkscape-3bf5ae0-x86_64.AppImage --appimage-offset
  • You should get a number like: 123456
  • Create a new dir which will be used as a mount point for this AppImage. In this case: inkscape
  • Mount this AppImage file: sudo mount Inkscape-3bf5ae0-x86_64.AppImage inkscape/ -o offset=123456 (this number is the offset you got 2 steps above)
  • You should be able to see what files are inside this package.
  • Assume that you have truelove5.dxf in your current dir, and the inkscape/ directory is also in the same directory as truelove5.dxf, run:
  • ./inkscape/usr/bin/python ./inkscape/usr/share/inkscape/extensions/dxf_input.py truelove5.dxf --output=dev_truelove5.svg --scalemethod=auto
  • Once done, remember to unmount your inkscape/, run: sudo umount inkscape/

For linux, if you do not want to do mount/umount, you can simply use cp -R to copy all the files into a separate folder. Then you can do the conversion at any time you want.

Hope it helps someone.

Original: https://alucard-blog.blogspot.com/2021/12/Inkscape-DXF-to-SVG-on-Linux-and-Windows-Command-line-solution.html

--

--