Node Markup is a helper library for kangax's Fabric.js to make it easier to crop images and add markup such as circles and rectangles. Node Markup has frontend (web site) and backend (Node.js) support for rendering identical images on both sides.
-
Install Node Markup dependencies
$ npm install
-
From the terminal, you can call ImageMarkupCall.js
$ node ImageMarkupCall.js --json '[json_string]'
TODO: The JSON schema is mostly undocumented, and the frontend works in a very different way from the backend, so the frontend will be more or less trial-and-error for the user (you) until I've finished documenting it.
- Do not include sourceFile or destinationFile in the frontend JSON. You can add a source image manually to the Fabric.js canvas, or leave it blank.
Long story short:
-
Include Fabric.js and ImageMarkupBuilder.js in the HTML
-
Create a
<canvas>
DOM object in the HTML -
Run that
<canvas>
object throughfabric.Canvas
var fabric = new fabric.Canvas('canvasid');
-
Run that fabric object trough
ImageMarkupBuilder
var markupBuilder = new ImageMarkupBuilder(fabric);
-
Send a JSON object (not string) through for processing
markupBuilder.processJSON(jsonObject);