depixel 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/lib.js +5 -0
  2. package/package.json +1 -1
package/lib.js CHANGED
@@ -89,6 +89,11 @@ function isSimilar(a, b, threshold) {
89
89
  const vB = 0.877 * (b[0] - yB);
90
90
  const t = Math.max(0, Math.min(255, threshold | 0)) / 255.0;
91
91
  if (Math.abs(a[3] - b[3]) <= (32.0/255) * t) {
92
+ if (a[3] + b[3] <= (32.0/255) * t) {
93
+ // treat all alpha=0 pixels as similar, regardless of color
94
+ // note: need an option for this if processing images with masks or premultiplied alpha
95
+ return true;
96
+ }
92
97
  if (Math.abs(yA - yB) <= (48.0 / 255.0) * t) {
93
98
  if (Math.abs(uA - uB) <= (7.0 / 255.0) * t) {
94
99
  if (Math.abs(vA - vB) <= (6.0 / 255.0) * t) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "depixel",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Depixelizing Pixel Art by Kopf-Lischinski and Felix Kreuzer for Node.js",
5
5
  "main": "lib.js",
6
6
  "keywords": [