Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a discussion PR. So discuss!
This adds a
traceSVG
function on theImage
object that gives back an SVG string of the traced output. You can also passposterize
to it, just for fun.This is using an additional Node library, which I don't love. I experimented with some pure JS SVG tracing implementations and couldn't find a good alternative, though. And I looked for a wasm one and couldn't find anything. That said, I'm not offended at how this works either! It's a pretty nice/simple dev facing API.
Here are some examples:
Trace on a logo:
![image](https://user-images.githubusercontent.com/7724/42355498-02fa4628-8093-11e8-8c01-c7b3512356d4.png)
Posterize on a photo:
![image](https://user-images.githubusercontent.com/7724/42355488-f8b05f72-8092-11e8-88dc-c2a891a67a86.png)