Ashesh
Ashesh

Reputation: 3599

How to save as a "Plain SVG" using Makefile with Inkscape

Using --verb=FileSave --verb=FileQuit in the make file saves the SVG as a Inkscape SVG with a lot of Inkscape window viewing information.

I am trying to get rid of it in-order to reduce the file size by saving as Plain SVG however there seem to be no specific VERB-ID to do this.

What modification do i need to make to the script so that I can get rid of the extra information in SVGs when genrating them?

Upvotes: 3

Views: 3698

Answers (1)

Use the option --export-type=svg to specify the format and the option --export-filename for the final file name.

inkscape --export-type=svg --export-filename=output.svg input.svg

See other options with:

inkscape --help

Additionally you can optimize the svg using the svgo tool:

svgo output.svg

Full scenario: you have a svg file called road.svg and want another one called road-plain.svg.

A sample makefile:

%-plain.svg: %.svg
    inkscape --export-type=svg --export-filename=$@ $<
    svgo $@

all: road-plain.svg

The output:

$ make all

inkscape --export-type=svg --export-filename=road-plain.svg road.svg
svgo road-plain.svg

road-plain.svg:
Done in 17 ms!
2.399 KiB - 74% = 0.624 KiB

It results in a plain and optimized SVG file!

Upvotes: 7

Related Questions