Skip to content

SVG: Inkscape-specific elements and attributes should be removed #803

@ilmari-lauhakangas

Description

@ilmari-lauhakangas

An example, a LibreOffice icon saved in Inkscape:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   viewBox="0 0 16 16"
   version="1.1"
   id="svg1"
   sodipodi:docname="onlineupdate_16_inkscape.svg"
   inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
  <defs
     id="defs1" />
  <sodipodi:namedview
     id="namedview1"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:showpageshadow="2"
     inkscape:pageopacity="0.0"
     inkscape:pagecheckerboard="0"
     inkscape:deskcolor="#d1d1d1"
     inkscape:zoom="49.4375"
     inkscape:cx="8.0101138"
     inkscape:cy="8"
     inkscape:window-width="1920"
     inkscape:window-height="1000"
     inkscape:window-x="0"
     inkscape:window-y="0"
     inkscape:window-maximized="1"
     inkscape:current-layer="svg1" />
  <path
     d="m3.5 2c-.82843 0-1.5.67157-1.5 1.5 0 .6558404.4135873 1.2024109 1 1.40625v6.1875c-.5864127.203839-1 .75041-1 1.40625 0 .82843.67157 1.5 1.5 1.5s1.5-.67157 1.5-1.5c0-.65584-.4135873-1.202411-1-1.40625v-6.1875c.0771596-.0268209.1479033-.0552639.21875-.09375l2.875 2.15625c-.0599582.1621025-.09375.348305-.09375.53125 0 .82843.67157 1.5 1.5 1.5s1.5-.67157 1.5-1.5-.67157-1.5-1.5-1.5c-.2847728 0-.5544546.0809461-.78125.21875l-2.84375-2.125c.0759039-.1794577.125-.3866425.125-.59375 0-.82843-.67157-1.5-1.5-1.5zm0 1c.27614 0 .5.22386.5.5s-.22386.5-.5.5-.5-.22386-.5-.5.22386-.5.5-.5zm5 4c.27614 0 .5.22386.5.5s-.22386.5-.5.5-.5-.22386-.5-.5.22386-.5.5-.5zm2.5.78125v4.3125l-2-2.03125v1.4375l2.28125 2.28125.21875.21875.21875-.21875 2.28125-2.28125v-1.4375l-2 2.03125v-4.3125zm-7.5 4.21875c.27614 0 .5.22386.5.5s-.22386.5-.5.5-.5-.22386-.5-.5.22386-.5.5-.5z"
     fill="#eff0f1"
     id="path1" />
</svg>

Result from minify:

<svg viewBox="0 0 16 16" id="svg1" sodipodi:docname="onlineupdate_16_inkscape.svg" inkscape:version="1.4 (e7c3feb100, 2024-10-09)" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"><defs id="defs1"/><sodipodi:namedview id="namedview1" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" inkscape:showpageshadow="2" inkscape:pageopacity="0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:zoom="49.4375" inkscape:cx="8.0101138" inkscape:cy="8" inkscape:window-width="1920" inkscape:window-height="1e3" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="svg1"/><path d="m3.5 2C2.67157 2 2 2.67157 2 3.5c0 .6558404.4135873 1.2024109 1 1.40625v6.1875c-.5864127.203839-1 .75041-1 1.40625.0.82843.67157 1.5 1.5 1.5S5 13.32843 5 12.5c0-.65584-.4135873-1.202411-1-1.40625v-6.1875c.0771596-.0268209.1479033-.0552639.21875-.09375l2.875 2.15625C7.0337918 7.1308525 7 7.317055 7 7.5 7 8.32843 7.67157 9 8.5 9S10 8.32843 10 7.5 9.32843 6 8.5 6c-.2847728.0-.5544546.0809461-.78125.21875L4.875 4.09375C4.9509039 3.9142923 5 3.7071075 5 3.5 5 2.67157 4.32843 2 3.5 2zm0 1c.27614.0.5.22386.5.5s-.22386.5-.5.5-.5-.22386-.5-.5.22386-.5.5-.5zm5 4c.27614.0.5.22386.5.5s-.22386.5-.5.5-.5-.22386-.5-.5.22386-.5.5-.5zm2.5.78125v4.3125L9 10.0625V11.5l2.28125 2.28125L11.5 14l.21875-.21875L14 11.5v-1.4375l-2 2.03125v-4.3125zM3.5 12c.27614.0.5.22386.5.5s-.22386.5-.5.5-.5-.22386-.5-.5.22386-.5.5-.5z" fill="#eff0f1" id="path1"/></svg>

Result from svgcleaner:

<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m3.5 2c-.82843 0-1.5.67157-1.5 1.5 0 .6558404.4135873 1.2024109 1 1.40625v6.1875c-.5864127.203839-1 .75041-1 1.40625 0 .82843.67157 1.5 1.5 1.5s1.5-.67157 1.5-1.5c0-.65584-.4135873-1.202411-1-1.40625v-6.1875c.0771596-.0268209.1479033-.0552639.21875-.09375l2.875 2.15625c-.0599582.1621025-.09375.348305-.09375.53125 0 .82843.67157 1.5 1.5 1.5s1.5-.67157 1.5-1.5-.67157-1.5-1.5-1.5c-.2847728 0-.5544546.0809461-.78125.21875l-2.84375-2.125c.0759039-.1794577.125-.3866425.125-.59375 0-.82843-.67157-1.5-1.5-1.5zm0 1c.27614 0 .5.22386.5.5s-.22386.5-.5.5-.5-.22386-.5-.5.22386-.5.5-.5zm5 4c.27614 0 .5.22386.5.5s-.22386.5-.5.5-.5-.22386-.5-.5.22386-.5.5-.5zm2.5.78125v4.3125l-2-2.03125v1.4375l2.28125 2.28125.21875.21875.21875-.21875 2.28125-2.28125v-1.4375l-2 2.03125v-4.3125zm-7.5 4.21875c.27614 0 .5.22386.5.5s-.22386.5-.5.5-.5-.22386-.5-.5.22386-.5.5-.5z" fill="#eff0f1"/></svg>

The result from svgcleaner is preferred as it is without any of the inkscape and sodipodi stuff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions