Socket
Socket
Sign inDemoInstall

imagetracerjs

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.1.2

deterministic.md

39

bower.json
{
"name": "imagetracerjs",
"version": "1.1.1",
"description": "Simple raster image tracer and vectorizer written in JavaScript.",
"description": "raster image tracer and vectorizer, bitmap to SVG converter",
"repository": {
"type": "git",
"url": "https://github.com/publiclab/Leaflet.DistortableImage.git"
"url": "https://github.com/jankovicsandras/imagetracerjs.git"
},
"main": "imagetracer_v1.1.1.js",
"ignore": [
"bower.json",
"imagetracerjs_documentation.html",
"index.html",
"panda.png",
"README.md",
"smiley.png"
],
"main": "imagetracer_v1.1.2.js",
"keywords": [
"image",
"tracer",
"tracing",
"vector",
"raster",
"vectorize",
"tracing"
"vectorizing",
"convert",
"conversion",
"converting",
"tracing",
"bitmap",
"svg",
"bmp",
"png",
"jpg",
"jpeg",
"gif"
],
"author": "András Jankovics",
"license": "Public Domain"
"authors": [ "András Jankovics" ],
"license": "Unlicense",
"bugs": {
"url": "https://github.com/jankovicsandras/imagetracerjs/issues"
},
"homepage": "https://github.com/jankovicsandras/imagetracerjs#readme"
}

@@ -5,3 +5,3 @@ "use strict";

var ImageTracer = require(__dirname +'/../imagetracer_v1.1.1');
var ImageTracer = require(__dirname +'/../imagetracer_v1.1.2');

@@ -8,0 +8,0 @@ // This example uses https://github.com/arian/pngjs

{
"name": "imagetracerjs",
"version": "1.1.1",
"version": "1.1.2",
"description": "raster image tracer and vectorizer, bitmap to SVG converter",
"main": "imagetracer_v1.1.1.js",
"main": "imagetracer_v1.1.2.js",
"scripts": {

@@ -14,25 +14,27 @@ "test": "node ./nodetest/nodetest.js"

"keywords": [
"image",
"image",
"tracer",
"svg",
"tracing",
"vectorizer",
"vector",
"raster",
"vectorize",
"vectorizing",
"convert",
"conversion",
"converting",
"tracing",
"bitmap",
"svg",
"bmp",
"png",
"jpg",
"jpeg",
"gif",
"bmp",
"convert"
"gif"
],
"author": "András Jankovics",
"license": "UNLICENSED",
"license": "Unlicense",
"bugs": {
"url": "https://github.com/jankovicsandras/imagetracerjs/issues"
},
"homepage": "https://github.com/jankovicsandras/imagetracerjs#readme",
"dependencies": {
"png.js": "^0.2.1"
}
"homepage": "https://github.com/jankovicsandras/imagetracerjs#readme"
}

@@ -8,2 +8,7 @@ # imagetracerjs

### 1.1.2
- minor bugfixes
- lookup based ```pathscan()```
### 1.1.1

@@ -17,14 +22,14 @@

- export as AMD module / Node module / browser or worker variable
- new syntax: ImageTracer.imageToTracedata(), no need to initialize
- fixed options with hasOwnProperty: 0 values are not replaced with defaults, fixed polygons with coordinates x=0 or y=0
- new syntax: ```ImageTracer.imageToTracedata()```, no need to initialize
- fixed ```options``` with hasOwnProperty: 0 values are not replaced with defaults, fixed polygons with coordinates x=0 or y=0
- transparency support: alpha is not discarded now, it is given more weight in color quantization
- new options.roundcoords : rounding coordinates to a given decimal place. This can reduce SVG length significantly (>20%) with minor loss of precision.
- new options.desc : setting this to false will turn off path descriptions, reducing SVG length.
- new options.viewbox : setting this to true will use viewBox instead of exact width and height
- new options.colorsampling : color quantization will sample the colors now by default, can be turned off.
- new options.blurradius : setting this to 1..5 will preprocess the image with a selective Gaussian blur with options.blurdelta treshold. This can filter noise and improve quality.
- imagedataToTracedata() returns image width and height in tracedata
- getsvgstring() needs now only tracedata and options as parameters
- colorquantization() needs now only imgd and options as parameters
- background field is removed from the results of color quantization and
- new ```options.roundcoords``` : rounding coordinates to a given decimal place. This can reduce SVG length significantly (>20%) with minor loss of precision.
- new ```options.desc``` : setting this to false will turn off path descriptions, reducing SVG length.
- new ```options.viewbox``` : setting this to true will use viewBox instead of exact width and height
- new ```options.colorsampling``` : color quantization will sample the colors now by default, can be turned off.
- new ```options.blurradius``` : setting this to 1..5 will preprocess the image with a selective Gaussian blur with options.blurdelta treshold. This can filter noise and improve quality.
- ```imagedataToTracedata()``` returns image width and height in tracedata
- ```getsvgstring()``` needs now only tracedata and options as parameters
- ```colorquantization()``` needs now only imgd and options as parameters
- background field is removed from the results of color quantization
- ESLint passed

@@ -36,3 +41,3 @@ - test automation and simple statistics in imagetracer_test_automation.html

```javascript
<script src="imagetracer_v1.1.0.js"></script>
<script src="imagetracer_v1.1.2.js"></script>
```

@@ -117,3 +122,3 @@ Then

var ImageTracer = require(__dirname +'/../imagetracer_v1.1.0');
var ImageTracer = require(__dirname +'/../imagetracer_v1.1.2');

@@ -153,18 +158,23 @@ // This example uses https://github.com/arian/pngjs

### Deterministic output
See [choices for deterministic tracing](https://github.com/jankovicsandras/imagetracerjs/blob/master/deterministic.md)
### Main Functions
|Function name|Arguments|Returns|Run type|
|-------------|---------|-------|--------|
|imageToSVG|image_url /*string*/ , callback /*function*/ , options /*optional object*/|Nothing, callback(svgstring) will be executed|Asynchronous|
|imagedataToSVG|[ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData) /*object*/ , options /*optional object*/|svgstring /*string*/|Synchronous|
|imageToTracedata|image_url /*string*/ , callback /*function*/ , options /*optional object*/|Nothing, callback(tracedata) will be executed|Asynchronous|
|imagedataToTracedata|[ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData) /*object*/ , options /*optional object*/|tracedata /*object*/|Synchronous|
|```imageToSVG```|```image_url /*string*/ , callback /*function*/ , options /*optional object*/```|Nothing, ```callback(svgstring)``` will be executed|Asynchronous|
|```imagedataToSVG```|```imagedata /*object*/ , options /*optional object*/```|```svgstring /*string*/```|Synchronous|
|```imageToTracedata```|```image_url /*string*/ , callback /*function*/ , options /*optional object*/```|Nothing, ```callback(tracedata)``` will be executed|Asynchronous|
|```imagedataToTracedata```|```imagedata /*object*/ , options /*optional object*/```|```tracedata /*object*/```|Synchronous|
```imagedata``` is standard [ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData) here, ```canvas``` is [canvas](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas) .
#### Helper Functions
|Function name|Arguments|Returns|Run type|
|-------------|---------|-------|--------|
|appendSVGString|svgstring /*string*/, parentid /*string*/|Nothing, an SVG will be appended to the container div with id=parentid.|Synchronous|
|loadImage|url /*string*/, callback /*function*/|Nothing, loading an image from a URL, then executing callback(canvas)|Asynchronous|
|getImgdata|[canvas](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas) /*object*/|[ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData) /*object*/|Synchronous|
|```appendSVGString```|```svgstring /*string*/, parentid /*string*/```|Nothing, an SVG will be appended to the container div with id=parentid.|Synchronous|
|```loadImage```|```url /*string*/, callback /*function*/```|Nothing, loading an image from a URL, then executing ```callback(canvas)```|Asynchronous|
|```getImgdata```|```canvas /*object*/```|```imagedata /*object*/```|Synchronous|
```imagedata``` is standard [ImageData](https://developer.mozilla.org/en-US/docs/Web/API/ImageData) here, ```canvas``` is [canvas](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas) .
There are more functions for advanced users, read the source if you are interested. :)

@@ -175,18 +185,19 @@

|-----------|-------------|-------|
|ltres|1|Error treshold for straight lines.|
|qtres|1|Error treshold for quadratic splines.|
|pathomit|8|Edge node paths shorter than this will be discarded for noise reduction.|
|blurradius|0|Set this to 1..5 for selective Gaussian blur preprocessing.|
|blurdelta|20|RGBA delta treshold for selective Gaussian blur preprocessing.|
|pal|No default value|Custom palette, an array of color objects: ```[ {r:0,g:0,b:0,a:255}, ... ]```|
|numberofcolors|16|Number of colors to use on palette if pal object is not defined.|
|mincolorratio|0.02|Color quantization will randomize a color if fewer pixels than (total pixels*mincolorratio) has it.|
|colorquantcycles|3|Color quantization will be repeated this many times.|
|scale|1|Every coordinate will be multiplied with this, to scale the SVG.|
|colorsampling|true|Enable or disable color sampling.|
|viewbox|false|Enable or disable SVG viewBox.|
|desc|true|Enable or disable SVG descriptions.|
|lcpr|0|Straight line control point radius, if this is greater than zero, small circles will be drawn in the SVG. Do not use this for big/complex images.|
|qcpr|0|Quadratic spline control point radius, if this is greater than zero, small circles and lines will be drawn in the SVG. Do not use this for big/complex images.|
|layercontainerid|No default value|Edge node layers can be visualized if a container div's id is defined.|
|```ltres```|```1```|Error treshold for straight lines.|
|```qtres```|```1```|Error treshold for quadratic splines.|
|```pathomit```|```8```|Edge node paths shorter than this will be discarded for noise reduction.|
|```pal```|No default value|Custom palette, an array of color objects: ```[ {r:0,g:0,b:0,a:255}, ... ]```|
|```colorsampling```|```true```|Enable or disable color sampling.|
|```numberofcolors```|```16```|Number of colors to use on palette if pal object is not defined.|
|```mincolorratio```|```0.02```|Color quantization will randomize a color if fewer pixels than (total pixels*mincolorratio) has it.|
|```colorquantcycles```|```3```|Color quantization will be repeated this many times.|
|```blurradius```|```0```|Set this to 1..5 for selective Gaussian blur preprocessing.|
|```blurdelta```|```20```|RGBA delta treshold for selective Gaussian blur preprocessing.|
|```scale```|```1```|Every coordinate will be multiplied with this, to scale the SVG.|
|```roundcoords```|```1```|rounding coordinates to a given decimal place. 1 means rounded to 1 decimal place like 7.3 ; 3 means rounded to 3 places, like 7.356|
|```viewbox```|```false```|Enable or disable SVG viewBox.|
|```desc```|```true```|Enable or disable SVG descriptions.|
|```lcpr```|```0```|Straight line control point radius, if this is greater than zero, small circles will be drawn in the SVG. Do not use this for big/complex images.|
|```qcpr```|```0```|Quadratic spline control point radius, if this is greater than zero, small circles and lines will be drawn in the SVG. Do not use this for big/complex images.|
|```layercontainerid```|No default value|Edge node layers can be visualized if a container div's id is defined.|

@@ -193,0 +204,0 @@ The almost complete options object:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc