Inkscape.org
Beyond the Basics Using `--export-area-drawing` while ignoring objects outside page
  1. #1
    milad milad @milad

    I was wondering if it's possible to use `--export-area-drawing` but only get it applied to objects _inside_ the page. I keep a bunch of assets outside the page and want them to be ignored when I'm exporting via command line.

    I don't want to use the `--export-id` stuff because I'm trying to write a generic shell script.

  2. #2
    inklinea inklinea @inklinea⛰️

    Is there a reason you don't want to use `export-area-page`

     

  3. #3
    milad milad @milad

    I mean `--export-area-drawing` is exactly the behavior I want but I want inkscape to ignore everything outside the page. I thought I could chain a `--export-area-page --export-type svg` with a `--export-area-drawing --export-type png`  but I think `--export-area-page` doesn't actually get rid of stuff outside page if both input and output are SVGs.

  4. #4
    inklinea inklinea @inklinea⛰️

    In that case the easiest way to do it, is to have your assets in a known layer or in layers with a know id prefix.

    you can use a select that layer then - and delete before export.

    For Inskcape 1.2

    inkscape --actions="select-by-id:asset_layer;delete;export-do" ./canvas.svg 

    or

    inkscape --actions="select-by-selector:[id|=ass];delete;export-do" ./canvas.svg

    which gets any layers which start with 'ass'

    or if you are feeling very clever - you can use:

    inkscape --actions="select-all:layers;select-list" ./canvas.svg

    to get the layer names, then: 

    inkscape --query-all

    to get the bounding boxes in pixels for all objects. loop through and destroy any with over lap the layer1

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Using `--export-area-drawing` while ignoring objects outside page