Suggestion: Remove elements that are not visible
ygra opened this issue · comments
This includes:
- Paths with empty geometry or only moveto commands
- shapes in general that are not rendered, e.g. rectangle with zero height/width
- elements with opacity: 0 or fully transparent strokes and fills
@ygra This is implemented in svgo, however removing visibility="hidden"
, opacity="0"
, display="none"
, fill-opacity="0" stroke-opacity="0"
might delete important editor-data. If something is set to hidden (and not removed) it is done (mostly) purposly.
However this could break the file:
- removing invisble elements leeds to problems e.g. with flowRoot. The rect should be invisible see removing black rectangle or Problems with SVG 1.2 but removing would lead to removing of the visibility of the flowPara.
However there are other issues relating to it, if you want to re-edit the file:
display="none"
is used by inkscape for hidden layers (e.g. for source-data of text that was converted to path, of traced rasterdata, comments, ...)fill-opacity="0" stroke-opacity="0"
andopacity="0"
is recommended by Wikimedia for svg-files were you converted text to path and to hide the actual text (textrendering differs between renderer quit much) and deleting the real text should not be done, nor does not save much space.- path with empty geometry or recatangles with zero height does imho not ocour often
- rect with zero height in flowRoot won't get rendered, but they can still store the position of the text (which wont get rendered)