Skip to content

Conversation

@catdad
Copy link

@catdad catdad commented Oct 25, 2018

Currently, SVG output is supported, though not by providing output in options, the same way that jpg, png, and gif are supported. Here's a repro (though it's quite obvious):

primitive({
  input: 'in.jpg',
  numSteps: 2,
  output: 'out.svg'
}).then(() => {
  console.log('done?');
}).catch(err => {
  console.error(err);
  process.exitCode = 1;
});
1) { time: '7s', candidates: 786, score: 0.1721898251231621 }
2) { time: '4s', candidates: 618, score: 0.1389077911406503 }
Error: Unsupported file type: svg
    at savePixels (D:\Git\primitive\node_modules\save-pixels\save-pixels.js:139:23)
    at Object.saveImage (D:\Git\primitive\lib\context.js:58:18)
    at default (D:\Git\primitive\module.js:124:21)
    at <anonymous>

All the support for SVG already exists (and in fact is documented). This PR just adds the save functionality.

@jlarmstrongiv
Copy link

Thanks for this pr! Super helpful 😄 hope it gets merged soon

To install the pull request, run

npm i git+https://github.com/catdad-experiments/primitive.git\#save-svg

To install a version without the console.log, run

npm i git+https://github.com/jlarmstrongiv/primitive.git\#patch-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants