daem-on / wtherion

A web-based Therion map editor
https://daem-on.github.io/wtherion/
MIT License
17 stars 2 forks source link

wish - auto trace a line #13

Closed Shemesh closed 2 years ago

Shemesh commented 2 years ago

hi, this is a real awesome project! BRAVO! makes therion a real pleasure.

wish - auto trace (convert) a line in png to vector. instead of drawing a point-to-point vector line according to an image, make the app do it for me. similar to https://www.npmjs.com/package/imagetracerjs

is this possible?

daem-on commented 2 years ago

Hi! Thanks for your suggestion (and also the kind words). What you described can't be done with simple raster to vector tracing, because you would get shapes instead of paths as the vector result. So imagetracerjs would not work here. The thing you would use for tracing a bitmap to paths is called centerline tracing (or midline tracing), and there are many solutions to this, but unfortunately there aren't any in JavaScript that I have seen.

Anyway, what you described can be done already, just not in wtherion. You can use Inkscape and the trace bitmap functionality with the "centerline tracing" setting to create paths. You can then use the Inkscape Therion plugins to convert it to a Therion source file. This is very easy to do, the hard part is manually correcting all the errors of the trace and then tagging all the lines.

But the important part is that wtherion is not set up for this kind of workflow, of making lines based on a bitmap image, and then tagging those lines afterward to the correct types and subtypes for Therion. If you want to do that, the Inkscape plugins should work, but I'm pretty sure it's just as quick for an experienced user to draw the lines in wtherion as it is to trace a bitmap and then fix all the errors and tag all the lines.

Shemesh commented 2 years ago

tnx for the hint about the inkscape-therion plugins. keep up the good work on wtherion!