pica 6.1.0 → 7.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  pica - high quality image resize in browser
2
2
  ===========================================
3
3
 
4
- [![Build Status](https://travis-ci.org/nodeca/pica.svg?branch=master)](https://travis-ci.org/nodeca/pica)
4
+ [![CI](https://github.com/nodeca/pica/actions/workflows/ci.yml/badge.svg)](https://github.com/nodeca/pica/actions/workflows/ci.yml)
5
5
  [![NPM version](https://img.shields.io/npm/v/pica.svg)](https://www.npmjs.org/package/pica)
6
6
 
7
7
  > Resize images in browser without pixelation and reasonably fast.
@@ -20,7 +20,16 @@ With pica you can:
20
20
 
21
21
  **Note. If you need File/Blob resize (from form's file input), consider use
22
22
  [image-blob-reduce](https://github.com/nodeca/image-blob-reduce).** It has
23
- additional machinery to process orientation, keep EXIF metadata and so on.
23
+ additional machinery to process orientation, keep EXIF metadata and so on.
24
+
25
+
26
+ Migration from pica v6 to pica v7
27
+ ---------------------------------
28
+
29
+ Multiply `unsharpAmount` by 2, divide `unsharpThreshold` by 2, example:
30
+
31
+ - `pica@6`: `pica.resize(a, b, { unsharpAmount: 80, unsharpThreshold: 2 })`
32
+ - `pica@7`: `pica.resize(a, b, { unsharpAmount: 160, unsharpThreshold: 1 })`
24
33
 
25
34
 
26
35
  Prior to use
@@ -32,7 +41,7 @@ Here is a short list of problems you can face:
32
41
  - Due to JS security restrictions, you can process images
33
42
  from the same domain or local files only. If you load images from
34
43
  remote domain use proper `Access-Control-Allow-Origin` header.
35
- - iOS has a memory limits for canvas elements, that may cause
44
+ - iOS has a memory limits for canvas elements, that may cause
36
45
  problems in some cases, [more details](https://github.com/nodeca/pica/wiki/iOS-Memory-Limit).
37
46
  - If your source data is jpeg image, it can be rotated. Consider use
38
47
  [image-blob-reduce](https://github.com/nodeca/image-blob-reduce).
@@ -67,9 +76,9 @@ const pica = require('pica')();
67
76
 
68
77
  // Resize from Canvas/Image to another Canvas
69
78
  pica.resize(from, to, {
70
- unsharpAmount: 80,
79
+ unsharpAmount: 160,
71
80
  unsharpRadius: 0.6,
72
- unsharpThreshold: 2
81
+ unsharpThreshold: 1
73
82
  })
74
83
  .then(result => console.log('resize done!'));
75
84
 
@@ -101,8 +110,8 @@ Create resizer instance with given config (optional):
101
110
  Default returns a [\<canvas\> element](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API),
102
111
  but this function could return an [OffscreenCanvas](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas)
103
112
  instead (to run pica in a Service Worker). Function signature: createCanvas(width: number, height: number): Canvas
104
-
105
-
113
+
114
+
106
115
  __Important!__ Latest browsers may support resize via [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap).
107
116
  This feature is supported (`cib`) but disabled by default and not recommended
108
117
  for use. So:
@@ -125,7 +134,7 @@ taken from source and destination objects.
125
134
  - __quality__ - 0..3. Default = `3` (lanczos, win=3).
126
135
  - __alpha__ - use alpha channel. Default = `false`.
127
136
  - __unsharpAmount__ - >=0, in percents. Default = `0` (off). Usually
128
- between 50 to 100 is good.
137
+ between 100 to 200 is good.
129
138
  - __unsharpRadius__ - 0.5..2.0. By default it's not set. Radius of Gaussian
130
139
  blur. If it is less than 0.5, Unsharp Mask is off. Big values are clamped
131
140
  to 2.0.
@@ -198,10 +207,10 @@ a bit. Pica has built-in "unsharp mask" filter (off by default).
198
207
  Set `unsharpAmount` to positive number to activate the filter.
199
208
 
200
209
  Filter's parameters are similar to ones from Photoshop.
201
- We recommend to start with `unsharpAmount = 80`,
202
- `unsharpRadius = 0.6` and `unsharpThreshold = 2`.
210
+ We recommend to start with `unsharpAmount = 160`,
211
+ `unsharpRadius = 0.6` and `unsharpThreshold = 1`.
203
212
  There is [a correspondence between UnsharpMask parameters
204
- in popular graphics software](https://github.com/nodeca/pica/wiki#editing-unsharp-mask-params-relations-in-pupular-softare).
213
+ in popular graphics software](https://github.com/nodeca/pica/wiki/Unsharp-mask-params-in-popular-softare).
205
214
 
206
215
 
207
216
  Browser support