2tikz
A minimal http server that accepts .png and .svg fils, vectorizes the .pngs and returns .tikz code for inclusion in .tex files.
Last updated 2 years ago by yeldir .
ISC · Original npm · Tarball · package.json
$ cnpm install 2tikz 
SYNC missed versions from official npm registry.

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);
    });

Current Tags

  • 1.0.0                                ...           latest (2 years ago)

1 Versions

  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 4
Dependencies (6)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |