-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a function to do in-memory conversion #59
Conversation
Thank you for your contribution. I don't mind a rewrite of the cli at all. As per the other issue, do you think it's also needed to add |
I’m not sure the right one should be |
Looking at the docs https://doc.rust-lang.org/beta/reference/linkage.html again I think adding |
This lets us decouple file reading/writing from the actual conversion.
Instead the input_path and output_path have to be passed to convert_image_to_svg() manually.
78f283b
to
1361c50
Compare
Thanks for the I’ve pushed a new version, rebased on top of master, with the Python binding fixed to use the new API (the Python API stays identical). |
This lets the user convert an image from memory, without encoding it to PNG, writing it to a file, then reopening this file and decoding it using the image crate. It also allows the user to not write a SVG directly to a file.
1361c50
to
75e4b90
Compare
Thank you for the update. Allow me a bit of time to go through this ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks pretty good. Only blocked by me to actually try this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
I published on https://crates.io/crates/vtracer/0.6.3 |
This PR is best viewed commit per commit.
The goal is to make vtracer more usable as a library, in order to do so I have moved out path handling and clap parsing from the
Config
struct. This makes it much better than going through a PNG file, especially when the application already has pixels in memory.A future commit can make clap and image optional for building the library (in the latter case the
convert_image_to_svg()
function won’t be available).This is a public API change, because
convert_image_to_svg()
now takes the input and output paths as arguments, whereas before they were passed in theConfig
struct, so a minor version bump will have to follow for the next release.