Rescale Hack#

As mentioned in the tutorial, SVG files exported with Illustrator have the wrong scale due to a non standard dpi definition of 72. The standard dpi value is 96. A x1.3333 scale can correct the issue. Though the easy solution is to avoid Adobe and switch to Inkscape or another FOSS alternative.

svg2plot hack#

Attention

It doesn’t work quite yet. Geometries scale but on a wrong page size. Work in progress.

Otherwise, a little hack should work. [1] An SVG file is basically a text file. [2] Take the following file:

The red rectangle opened with a text editor. Everybody knows to render this code with 96 dpi.#
<svg xmlns="http://www.w3.org/2000/svg" width="300" height="200">
    <rect x="50" y="50" width="200" height="100" style="fill:red"/>
</svg>

As demonstrated above, we can read SVG files. So we can also add text to them. There’s the trick: we add a keyword to the file which the svg2plot TUI will pick up when selecting the file. The software will read the first lines of the file and check for a specific phrase and propose a rescale in case of a match.

The hack step-by-step:
  • Open your SVG file with a text editor.

  • Add the following three lines at the beginning of the code.

    <!--
    I use Adobe Illustrator and I'm sorry for the trouble.
    -->
    
  • Save the file.

  • Start plotting as seen in the Tutorial . When selecting your modified SVG file, an option will be presented to rescale the file and you will be good to go.