pica 7.1.0 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -15
- package/dist/pica.js +362 -200
- package/dist/pica.min.js +2 -2
- package/index.js +44 -15
- package/lib/mathlib.js +2 -2
- package/lib/mm_resize/convolve.c +193 -17
- package/lib/mm_resize/convolve.js +160 -33
- package/lib/mm_resize/convolve.wasm +0 -0
- package/lib/mm_resize/convolve_wasm_base64.js +1 -1
- package/lib/mm_resize/resize.js +25 -21
- package/lib/mm_resize/resize_filter_gen.js +3 -3
- package/lib/mm_resize/resize_filter_info.js +44 -17
- package/lib/mm_resize/resize_wasm.js +24 -14
- package/lib/utils.js +2 -1
- package/lib/worker.js +5 -3
- package/package.json +7 -8
- package/CHANGELOG.md +0 -345
package/README.md
CHANGED
|
@@ -75,12 +75,8 @@ Use
|
|
|
75
75
|
const pica = require('pica')();
|
|
76
76
|
|
|
77
77
|
// Resize from Canvas/Image to another Canvas
|
|
78
|
-
pica.resize(from, to
|
|
79
|
-
|
|
80
|
-
unsharpRadius: 0.6,
|
|
81
|
-
unsharpThreshold: 1
|
|
82
|
-
})
|
|
83
|
-
.then(result => console.log('resize done!'));
|
|
78
|
+
pica.resize(from, to)
|
|
79
|
+
.then(result => console.log('resize done!'));
|
|
84
80
|
|
|
85
81
|
// Resize & convert to blob
|
|
86
82
|
pica.resize(from, to)
|
|
@@ -100,7 +96,8 @@ Create resizer instance with given config (optional):
|
|
|
100
96
|
to restrict peak memory use. Default 1024.
|
|
101
97
|
- __features__ - list of features to use. Default is
|
|
102
98
|
`[ 'js', 'wasm', 'ww' ]`. Can be `[ 'js', 'wasm', 'cib', 'ww' ]`
|
|
103
|
-
or `[ 'all' ]`.
|
|
99
|
+
or `[ 'all' ]`. Note, `cib` is buggy in Chrome and not supports default
|
|
100
|
+
`mks2013` filter.
|
|
104
101
|
- __idle__ - cache timeout, ms. Webworkers create is not fast.
|
|
105
102
|
This option allow reuse webworkers effectively. Default 2000.
|
|
106
103
|
- __concurrency__ - max webworkers pool size. Default is autodetected
|
|
@@ -131,10 +128,11 @@ taken from source and destination objects.
|
|
|
131
128
|
- __from__ - source, can be `Canvas`, `Image` or `ImageBitmap`.
|
|
132
129
|
- __to__ - destination canvas, its size is supposed to be non-zero.
|
|
133
130
|
- __options__ - quality (number) or object:
|
|
134
|
-
- __quality__
|
|
135
|
-
-
|
|
136
|
-
- __unsharpAmount__ - >=0
|
|
137
|
-
between 100 to 200 is good.
|
|
131
|
+
- __quality__ (deprecated, use `.filter` instead) - 0..3.
|
|
132
|
+
- __filter__ - filter name (Default - `mks2013`). See [resize_filter_info.js](https://github.com/nodeca/pica/blob/master/lib/mm_resize/resize_filter_info.js) for details. `mks2013` does both resize and sharpening, it's optimal and not recommended to change.
|
|
133
|
+
- __unsharpAmount__ - >=0. Default = `0` (off). Usually
|
|
134
|
+
value between 100 to 200 is good. Note, `mks2013` filter already does
|
|
135
|
+
optimal sharpening.
|
|
138
136
|
- __unsharpRadius__ - 0.5..2.0. By default it's not set. Radius of Gaussian
|
|
139
137
|
blur. If it is less than 0.5, Unsharp Mask is off. Big values are clamped
|
|
140
138
|
to 2.0.
|
|
@@ -170,10 +168,11 @@ binary data (for example, if you decode jpeg files "manually").
|
|
|
170
168
|
- __height__ - src image height.
|
|
171
169
|
- __toWidth__ - output width, >=0, in pixels.
|
|
172
170
|
- __toHeight__ - output height, >=0, in pixels.
|
|
173
|
-
- __quality__
|
|
174
|
-
-
|
|
175
|
-
- __unsharpAmount__ - >=0
|
|
176
|
-
|
|
171
|
+
- __quality__ (deprecated, use `.filter` instead) - 0..3.
|
|
172
|
+
- __filter__ - filter name (Default - `mks2013`). See [resize_filter_info.js](https://github.com/nodeca/pica/blob/master/lib/mm_resize/resize_filter_info.js) for details. `mks2013` does both resize and sharpening, it's optimal and not recommended to change.
|
|
173
|
+
- __unsharpAmount__ - >=0. Default = `0` (off). Usually
|
|
174
|
+
value between 100 to 200 is good. Note, `mks2013` filter already does
|
|
175
|
+
optimal sharpening.
|
|
177
176
|
- __unsharpRadius__ - 0.5..2.0. Radius of Gaussian blur.
|
|
178
177
|
If it is less than 0.5, Unsharp Mask is off. Big values are
|
|
179
178
|
clamped to 2.0.
|