Skip to content

chchchchchchch/utils.layer2svg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

extract layers from an inkscape svg into separate svg files.

sed 's/ / \n/g' $SVG |                                   # REPLACE ALL SPACES WITH A LINEBREAK
sed '/^.$/d' |                                           # REMOVE ALL EMPTY LINES
sed -n '/<\/metadata>/,/<\/svg>/p' | sed '1d;$d' |       # PRINT SECTION BETWEEN </metadata> AND </svg> (EXCLUSIVE)
sed ':a;N;$!ba;s/\n/ /g' |                               # REMOVE ALL LINEBREAKS
sed 's/<\/g>/\n<\/g>/g' |                                # ADD LINEBREAK BEFORE GROUP END </g>
sed 's/\(<g.*inkscape:group[^>]*>\)/QWERTZUIOP\1/g' |    # ADD PLACEHOLDER BEFORE <g ... > CONTAINING GROUPMODE PATTERN
sed ':a;N;$!ba;s/\n/ /g' |                               # REMOVE ALL LINEBREAKS
sed 's/QWERTZUIOP/\n\n\n\n/g' | \                        # REPLACE PREVIOUSLY SUBSTITUTED PLACEHOLDER WITH NEWLINES
sed 's/display:none/display:inline/g'                    # MAKE HIDDEN LAYERS VISIBLE

About

extract layers from an inkscape svg into separate svg files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published