Input not filename
Portur opened this issue · 2 comments
Portur commented
Hi,
Is it possible to provide the image itself rather than the filename/path?
eg. a previous request wold be to get it and then after is to vectorize it.
let image = response.body || fs.readFile(imagePath, 'utf8')
then
ImageTracer.imageToSvg(image , callback)
Portur commented
I think the method for this is
imageTracer.imagedataToTraceData(image, options, traceData => { alert(traceData) })
.
My understanding was this was CLI only.
jankovicsandras commented
Hi,
Yes, it should work, only it is not using a callback function, but returning a value directly:
// imgd is an object like https://developer.mozilla.org/en-US/docs/Web/API/ImageData object, with .data .height .width fields
// Synchronous tracing to SVG string with options object
var svgstr = ImageTracer.imagedataToSVG( imgd, { scale:5 } );
// Synchronous tracing to tracedata with option preset
var tracedata = ImageTracer.imagedataToTracedata( imgd, 'Detailed' );