potrace icon indicating copy to clipboard operation
potrace copied to clipboard

Create a CLI command for potrace

Open CMCDragonkai opened this issue 1 year ago • 1 comments

It would be nice to be able to just run this from the command line.

Like potrace ./x.png ./x.svg.

I even wrote a script like this:

#!/usr/bin/env node

const fs = require('fs');
const process = require('process');
const potrace = require('oslllo-potrace');

/* eslint-disable no-console */
async function main(argv = process.argv) {
  argv = argv.slice(2);
  const imageIn = argv[0];
  const imageOut = argv[1];
  const traced = await potrace(imageIn).trace();
  await fs.promises.writeFile(imageOut, traced);
}

void main();

It's super basic atm.

CMCDragonkai avatar Jan 03 '25 20:01 CMCDragonkai

Cool. If you can make a PR I will be cool with merging it. Also, if you could use yargs like this that would be cool.

Ghustavh97 avatar Jan 05 '25 11:01 Ghustavh97