I have a SVG file that contains a set of icons.
For each icon there are two different objects in the SVG file. One is the icon itself (id=foo_icon
), and a second is a solid white rectangle behind the icon that defines the bounding box (id=foo_box
). This rectangle is solid (and not transparent) for easier handling within Inkscape.
I want to export each icon to PNG, with the correct bounding box, and with a transparent background. I would like to do this automatically, from a script.
I have tried the following:
inkscape -e foo_icon.png --export-id=foo_box icons.svg
This exports the icon with the correct bounding box, but the background is not transparent, because
foo_box
is exported and white.inkscape -e foo_icon.png --export-id=foo_icon --export-id-only icons.svg
This exports the icon correctly, with transparent background, but the bounding box is not correct (it is taken from
foo_icon
, instead offoo_box
).
Is there a way to achieve what I want? I need to tell Inkscape, for each icon ("foo"), to set the export area to the bounding box of foo_box
, but only export foo_icon
and hide all other objects.