0

Inkscape 0.92 asks the user if old files should be converted to match the new resolution.

Selection pop up

I aligned all old pictures in units of millimetre. How can I convert all old files with a script? Is there an inkscape argument I can use for a commandline like

find -name "*.svg" | xargs inkscape ...
Jonas Stein
  • 3,898
  • 4
  • 34
  • 55

1 Answers1

0

You might be able to get some way towards converting your files from the command line by looking at the file

/usr/share/inkscape/extensions/dpiswitcher.py

(or a similar location of your installation). This seems to be the code that does the conversion, and it seems to be runnable outside inkscape. I gave it the name of an svg file as argument and it wrote on stdout a version with these sorts of differences:

$ dpiswitcher.py /tmp/drawing.svg  >/tmp/new.svg
$ xmltidy  /tmp/new.svg 
$ xmltidy  /tmp/drawing.svg 
$ diff /tmp/drawing.svg  /tmp/new.svg

< <svg ... width="210mm" height="297mm" viewBox="0 0 744.09448819 1052.3622047" id="svg3336" version="1.1" inkscape:version="0.91 r13725" sodipodi:docname="drawing.svg">
---
> <svg ... width="793.700787417" height="1122.51968506" viewBox="0.0 0.0 793.700787403 1122.51968501" id="svg3336" version="1.1" inkscape:version="0.91 r13725" sodipodi:docname="drawing.svg">
17c17
<   <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1">
---
>   <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="matrix(1.066667,0.000000,0.000000,1.066667,0.000000,0.000000)">

This is the built-in help:

$ dpiswitcher.py --help
Usage: dpiswitcher.py [options] SVGfile
Options:
  --id=IDS              id attribute of object to manipulate
  --selected-nodes=SELECTED_NODES
            id:subpath:position of selected nodes, if any
  --switcher=SWITCHER   Select the DPI switch you want
  --action=ACTION       

You can default the switcher and action, but you may need to provide the list of ids and nodes. Perhaps if you convert a few files with the gui, then with this python script you can see if there are differences and so progress towards a solution.

meuh
  • 49,672
  • 2
  • 52
  • 114