Imagetracer.js
This extension is an InkScape wrapper for https://github.com/jankovicsandras/imagetracerjs. It utilized a standalone node.js executable to run the JavaScript code. It will be fed with embedded or linked images within InkScape.
The big difference between this tracer and all other tracers in recent InkScape is the fact that it is better capable of splitting an image into it's "isles" (cutouts). The regular tracers separate by colors or layers but not by objects. That makes it hard to work with sometimes. Imagetracer.js will vectorize your beautiful image into a more beautiful SVG trace with separated infills (break apart into single surfaces like a puzzle), that means you get a lot of single areas. However, this separation does not work flawlessly. It does not reach the quality of the software "Vector Magic". See also KVEC
Tip: You can separate the colors into handy layers if you want by using Styles To Layers
Notes about the code:
- tested to run with NodeJS v10.19.0 (and hopefully above)
-
some options were removed because they make no sense within Inkscape, like:
pal, scale, corseenabled, layercontainerid
Take Mario's cat Mister Charlie
Trace Charlie by running Imagertracer.js
Maybe you want to run Apply Transformations after running the extension because the imported SVG group will have it's own matrix transformation (XY translation and scaling) which could be annoying for you.
Play with Charlie
Splitting by ungrouping
Warning: Do not calculate on ultra large images. You might get errors like:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: 0x7fb77b79446c node::Abort() [/lib/x86_64-linux-gnu/libnode.so.64]
2: 0x7fb77b7944b5 [/lib/x86_64-linux-gnu/libnode.so.64]
3: 0x7fb77b9c0e6a v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/libnode.so.64]
4: 0x7fb77b9c10e1 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/libnode.so.64]
5: 0x7fb77bd5bc66 [/lib/x86_64-linux-gnu/libnode.so.64]
6: 0x7fb77bd6fa37 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/lib/x86_64-linux-gnu/libnode.so.64]
7: 0x7fb77bd3bdda v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/lib/x86_64-linux-gnu/libnode.so.64]
8: 0x7fb77bfc7424 v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/lib/x86_64-linux-gnu/libnode.so.64]
9: 0x2d292f85452b
Aborted (core dumped)
Error while processing input:
<--- Last few GCs --->
[7149:0x1eff140] 13889 ms: Mark-sweep 934.7 (959.0) -> 934.7 (959.0) MB, 92.5 / 0.0 ms (average mu = 0.642, current mu = 0.001) last resort GC in old space requested
[7149:0x1eff140] 13989 ms: Mark-sweep 934.7 (959.0) -> 934.7 (959.0) MB, 99.4 / 0.0 ms (average mu = 0.446, current mu = 0.000) last resort GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x2d292f85452b]
1: StubFrame [pc: 0x2d292f836510]
2: StubFrame [pc: 0x2d292f837f8d]
Security context: 0x1ac76ab2ee11 <JSObject>
3: new Uint8ClampedArray(aka Uint8ClampedArray) [0x1ac76ab43189](this=0x1331c8a02609 <the_hole>,0x01ad07902c99 <JSArray[63700992]>)
4: ConstructFrame [pc: 0x2d292f799edf]
5: StubFrame [pc: 0x2d292f874384]
6: /* anonymous */ [0x148beddd5bc9] [/home/tomate/.config/inksc...
Check the image file (maybe convert and save as new file) and try again.
Your parser command:
node imagetracerjs-master/nodecli/nodecli.js /tmp/imagetracerjs.png ltres 1.0 qtres 1.0 pathomit 8 rightangleenhance true colorsampling 0 numberofcolors 32 mincolorratio 0 numberofcolors 32 colorquantcycles 5 layering 0 strokewidth 1.0 linefilter false scale 1.0 roundcoords 1 viewbox false desc false blurradius 1 blurdelta 20.0
Keine Kommentare