ndjsontosvg.ndjsontosvg module

converts simplified quickdraw into separate svg files

ndjsontosvg.ndjsontosvg.ndjsontosvg(filein, numberofsamples, outsize=256, linecolour='black', backgroundcolour='white', outdir='./', checkifidentified=True, randomsort=True, inputsize=256)[source]

converts a multiline google quickdraw simplified format file into separate svg images.

Params filein:

the input json file

Params numberofsamples:
 

how many drawings to generate

Params outsize:

You can set the outsize, simplified quickdraw are designed for 256 x 256, and svg should scale easily, but for some applications that don’t scale svg well, you can set your own output size.

Params outdir:

the directory to write to.

Params checkifidenified:
 

if true we will check that recognized key is true before creating svg.

Params randomsort:
 

If true we will select a random set of drawings, not just the first numberofsamples

Params inputsize:
 

use this if the input ndjson is not 256x256

Raises:
  • ValueError – If more that 10000 samples requested.
  • KeyError – If ndjson is missing expected fields.
  • IOError – If output dir does not exist.