Author Topic: How To Use Interactive Mode ?  (Read 1980 times)

April 08, 2018, 07:44:39 AM
Read 1980 times

Gary68

  • Jr. Member

  • Offline
  • ***

  • 15
I'm having a hard time trying to figure out how to use Interactive mode effectively. My problem is I want to export small ares of a large SVG image as 256 x 256 png tiles. The tiles will be used for an web based map. I can create a batch file to utilize the command line options, for example:

Code: [Select]
inkscape d:\map.svg --export-png=d:\0.png --export-area=0:187464.567:6047.244:193511.811 -w256 -h256
inkscape d:\map.svg --export-png=d:\1.png --export-area=0:181417.323:6047.244:187464.567 -w256 -h256

However loading the map each time takes just under 3 minutes. Due to the large amount of tiles I want to process this could take months and thats spreading the load across multiple computers.

This is where I hoped Interactive mode would help me. For example if I load the map into Inkscape's UI as normal (it takes 3 mins as expected), and input the area I'm interested in, I can then export a 256 x 256 tile in a matter of seconds. But if I try to do the same in Interactive mode, it pretty much takes as long as the command line.

I'm hoping the problem is down to me not using Interactive mode correctly, but there isn't a great deal of information on how your supposed to use it, so I'm at a bit of a loss.

To reproduce the problem you can follow these seps:

1) Download the attached file or download the zipped version here https://www.4umaps.com/topomaps/data/svg_demomap.zip (file is called inkscape.svg). This is just an example of the sort of file sizes I'm dealing with.
2) Open the file in Inkscape (will take a few minutes) and manulally enter the follwoing to define an area for export:

Code: [Select]
x0: 6000
y0: 6000
x1: 16000
x2: 16000

Width: 256
Height: 256

3) Now export the file, for me it completes in a matter of seconds.

For Interactive mode I do the following:

1) Open the command line and execute:

Code: [Select]
inkscape inkscape.svg --shell

2) In the Inkscape prompt I then call:

Code: [Select]
inkscape.svg --export-png=test1.png --export-area=6000:6000:16000:16000 -w256 -h256
inkscape.svg --export-png=test2.png --export-area=6100:6000:16100:16000 -w256 -h256
inkscape.svg --export-png=test3.png --export-area=6200:6000:16200:16000 -w256 -h256
inkscape.svg --export-png=test4.png --export-area=6000:6100:16000:16100 -w256 -h256
inkscape.svg --export-png=test5.png --export-area=6000:6200:16000:16200 -w256 -h256

But the above takes just as long as if I load each file individually, roughly 15 minutes for all 5. Whether I call each line individually or paste all 5 in one go, it still takes 3 minutes to process each line. Where as if I just entered them manually in the GUI it could be done in seconds. This seems to make the Interactive mode redundant as its no faster than using the command line?

But like I said I'm hoping thats its just down to me not using it correctly and that Interactive mode can provide some significant time savings?

Thanks in advance :)
  • 0.92
  • Windows 10

April 08, 2018, 01:12:56 PM
Reply #1

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Why do you open the SVG file again and again, when it is already open?

April 08, 2018, 01:37:12 PM
Reply #2

Gary68

  • Jr. Member

  • Offline
  • ***

  • 15
Quote (selected)
Why do you open the SVG file again and again, when it is already open?

Because in Interactive mode it doesn't do anything If I don't, no output in the console or in the form of exported files.
  • 0.92
  • Windows 10

April 08, 2018, 01:40:13 PM
Reply #3

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Upon closer inspection, it might not be possible to chain export commands, but only verbs. Wow. Didn't know that, sorry.

April 08, 2018, 01:41:17 PM
Reply #4

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Theoretically it should still be faster, as Inkscape itself does not need to start up for each run, only the file needs to be opened.... Not sure what could be the reason.

April 08, 2018, 01:49:57 PM
Reply #5

Gary68

  • Jr. Member

  • Offline
  • ***

  • 15
Quote (selected)
Upon closer inspection, it might not be possible to chain export commands, but only verbs. Wow. Didn't know that, sorry.

No worries, at least I know for sure now, thanks for looking into it.
  • 0.92
  • Windows 10

April 08, 2018, 06:03:05 PM
Reply #6

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Just curious.  What is "interactive mode"?
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

April 08, 2018, 06:50:17 PM
Reply #7

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Type 'inkscape --shell' on the command line to get it.

April 08, 2018, 07:06:49 PM
Reply #8

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Is it a special way to use the commandline?  Or is it another name for the commandline?

(moving this topic to Beyond the Basics)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

April 09, 2018, 01:11:16 AM
Reply #9

Gary68

  • Jr. Member

  • Offline
  • ***

  • 15
Quote (selected)
Just curious.  What is "interactive mode"?

It's an alternative form of command line:

Quote (selected)
--shell

With this parameter, Inkscape will enter an interactive command line shell mode. In this mode, you type in commands at the prompt and Inkscape executes them, without you having to run a new copy of Inkscape for each command. This feature is mostly useful for scripting and server uses: it adds no new capabilities but allows you to improve the speed and memory requirements of any script that repeatedly calls Inkscape to perform command line tasks (such as export or conversions). Each command in shell mode must be a complete valid Inkscape command line but without the Inkscape program name, for example:

file.svg --export-pdf=file.pdf

I guess this sums it up:

Quote (selected)
without you having to run a new copy of Inkscape for each command

For me it takes a couple of seconds to load Inkspace so the savings are negligible and I've ran it thousands of times through the command line and never ran into memory issues.
  • 0.92
  • Windows 10

April 09, 2018, 09:58:46 PM
Reply #10

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Thanks for explaining  :)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann