Inkscape.org
Beyond the Basics --shell mode: is it possible to export MULTIPLE objects by id?
  1. #1
    Felix Hoepke Felix Hoepke @F2CPP

    Hi, have been using Inksape for many years, attempting batch processing now. From MAN page, --shell:

    file-open:file1.svg; export-id:rect2; export-id-only; export-type:png; export-do

    works fine however, "export-id:rect2,rect1;" does not. Alternatively I tried

    inkscape --export-id=rect2; --export-filename=file2.png file2.svg

    but the result is already different from the above (the export seems to go by page/area, not object id).

    Is shell mode capable of exporting multiple objects by id, or is there an alternative I'm missing?

     Thanks

     

  2. #2
    inklinea inklinea @inklinea⛰️

    Shell mode is a special case, for running actions quickly without closing down an instance of Inkscape.

    file-open:object_test.svg; export-id-only; export-type:png; export-id:path149; export-do; export-id:rect31; export-do;export-id:text3277; export-do;

    Should work for multiple ids, one at a time.

    For exporting multiple ids at the same time, usually I would use select-by-id with mutiple ids comma separated, then select-invert, then EditDelete

    However EditDelete is a verb so not available in shell mode.

  3. #3
    Felix Hoepke Felix Hoepke @F2CPP

    @inklinea Thanks for your reply, which makes perfect sense -my question wasn't precise enough though, and should be: Is it possible to export multiple objects by id (from single svg file) to single png file (i.e. "in one go")? Prefereably by --shell, but you also mention the command line: Something like

    inkscape object_test.svg --export-id:path149,rect31; --export-type:png;

    does not work? I'd need to use --select=path149,rect31; ?

  4. #4
    inklinea inklinea @inklinea⛰️

    I've tried lots of combinations in the past, it does say in the option --export-id= , that it should be able to accept multiple ids.

    However I can't get this to work. 

    The only way I have been able to do it is to use select-by-id, select-invert, EditDelete then export the result.

    Also when you say batch processing, do you mean across multiple files or just batch processing objects within the svg ? 

     

     

  5. #5
    Felix Hoepke Felix Hoepke @F2CPP

    'Batch processing' to me actually meant merely doing things from the command line, in this case, only for a single drawing, for now anyway.

    With everything said, --shell mode is my best option, and assuming development is ongoing, I keep an eye on it, maybe doing more manually inside the drawing to get the ids export-ready e.g. by grouping.

    Many thanks for your help.

  6. #6
    inklinea inklinea @inklinea⛰️

    Have a look at the link in this thread : 

    https://inkscape.org/forums/extensions/clip-out/

    I did write a simple batch script a while ago, maybe you could modify it ?

    If you are using Windows - https://inkscape.org/forums/beyond/passing-a-batch-file-to-inkscape-in-shell-mode/#c26221

     

     

  7. #7
    Tyler Durden Tyler Durden @TylerDurden

     I'm not much for scripting, but it sounds like the OP wants select-by-id, select-by-id, select-by-id, export-do. PNG export defaults to selected items in a single PNG. The catch is the other settings, like hide unselected, etc.

  8. #8
    Felix Hoepke Felix Hoepke @F2CPP

    @TylerDurden  Thanks for your reply. What I also tried, in --shell, was

    file-open:file1.svg; export-id:rect1; export-id:rect2; export-id-only; export-type:png; export-do

    and

    file-open:file1.svg; export-id:rect1; export-id-only; export-id:rect2; export-id-only; export-type:png; export-do

    and

    file-open:file1.svg; export-id:rect1; export-id-only; export-id:rect2; export-type:png; export-do

    all unsuccessfully (I think exported got either only last listed id or whole page again).

Inkscape Inkscape.org Inkscape Forum Beyond the Basics --shell mode: is it possible to export MULTIPLE objects by id?