2tikz
v1.0.0
Published
A minimal http server that accepts .png and .svg fils, vectorizes the .pngs and returns .tikz code for inclusion in .tex files.
Downloads
9
Readme
2tikz
2tikz is a small standalone http server that accepts svg and png data and
returns tikz code, which can be compiled with latex.
Png files will be vectorized using potrace.
Bear in mind that that means, that text content in the pngs will be of varying
quality in the resulting .tikz file. Also potrace only supports greyscale output.
requirements
- NPM
- Python
setup
npm install
This downloads all needed dependencies and creates a python virtualenv including svg2tikz.
starting the server
npm run
example requests
PNG:
$.ajax({
"url": url,
"method": "POST",
"accepts": {
"text": "text/plain"
},
"data": pngDataUri,
"content-type": "image/png",
"processData": false
})
.then(function (data) {
console.log(data);
}, function (error) {
console.warn(error);
});
SVG:
$.ajax({
"url": url,
"method": "POST",
"accepts": {
"text": "text/plain"
},
"data": svgString,
"content-type": "image/svg+xml",
"processData": false
})
.then(function (data) {
console.log(data);
}, function (error) {
console.warn(error);
});