Inkscape.org
Creating New Extensions Open 2 images from cli
  1. #1
    rapcat rapcat @rapcat

    Hi all, congrats for the awesome work.

    I would like to know if it is possible to open 2 images from the interactive shell, without gui. The solution I'm thinking of is with Python, creating a .svg file containing the 2 images and then opening it from the shell. Is there a simpler and more efficient way?

  2. #2
    inklinea inklinea @inklinea⛰️

    It's not possible to create new elements from the command line.

    However you may be able to workaround without having to use python.

    Assumming you are referring to bitmap images.

    If you have a template with a dummy <image> tag.

    You can use select-by-id

    then object-set-attribute to set the xlink:href (or href I think in 1.3+)

    I've not tried this myself.

    I've never tried to set a base64 encoded image property either. I think you would have to use powershell in windows

    (not the standard command line due to max command line length) 

    Both bash (linux) and Powershell come with base64 encoding commands as standard.

    If the above does not work. 

    I usually chop the </svg> tag off, insert whatever I want as text, add the </svg> back then resave.

    Theres a couple examples on the forum here of me doing that in bash and possible powershell too :)

  3. #3
    rapcat rapcat @rapcat

    Thank you very much for your answer :)  I ended making integration on python, inserting the base64 images on xml template works fine