Initial commit
This commit is contained in:
commit
e49726988c
5445 files changed
+1089914
No files matched your search
+49
@@ -0,0 +1,49 @@
|
||||
# image-quantization (https://github.com/igor-bezkrovny/image-quantization)
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Igor Bezkrovny
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
# http://members.ozemail.com.au/~dekker/NEUQUANT.HTML
|
||||
|
||||
NeuQuant Neural-Net Quantization Algorithm
|
||||
------------------------------------------
|
||||
|
||||
Copyright (c) 1994 Anthony Dekker
|
||||
|
||||
NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See
|
||||
"Kohonen neural networks for optimal colour quantization" in "Network:
|
||||
Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of
|
||||
the algorithm.
|
||||
|
||||
Any party obtaining a copy of these files from the author, directly or
|
||||
indirectly, is granted, free of charge, a full and unrestricted irrevocable,
|
||||
world-wide, paid up, royalty-free, nonexclusive right and license to deal in
|
||||
this software and documentation files (the "Software"), including without
|
||||
limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons who
|
||||
receive copies from any such party to do so, with the only requirement being
|
||||
that this copyright notice remain intact.
|
||||
|
||||
# https://github.com/leeoniya/RgbQuant.js
|
||||
|
||||
Copyright (c) 2015, Leon Sorokin
|
||||
All rights reserved. (MIT Licensed)
|
||||
+347
@@ -0,0 +1,347 @@
|
||||
## image-q
|
||||
|
||||
Complete Image Quantization Library in **TypeScript** _(MIT License)_
|
||||
|
||||
[](https://ibezkrovnyi.github.io/image-quantization-demo/)
|
||||
[](https://github.com/ibezkrovnyi/image-quantization/tree/main/packages/image-q)
|
||||
[](https://www.npmjs.com/package/image-q)
|
||||
[](http://ibezkrovnyi.github.io/image-quantization/)
|
||||
[](LICENSE)
|
||||
|
||||

|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [<span style="color: red">API Documentation and Usage</span>](http://ibezkrovnyi.github.io/image-quantization/)
|
||||
- [Introduction](#introduction)
|
||||
- [Features](#features)
|
||||
- [Todo](#todo)
|
||||
- [Breaking changes](#breaking-changes)
|
||||
- [Changelog](#changelog)
|
||||
- [Credits](#credits)
|
||||
- [References](#references)
|
||||
- [License](#license)
|
||||
|
||||
## Introduction
|
||||
|
||||
Image Color Number Reduction with alpha support using RGBQuant/NeuQuant/Xiaolin Wu's algorithms and Euclidean/Manhattan/CIEDE2000 color distance formulas in TypeScript
|
||||
|
||||
## Features
|
||||
|
||||
1. Platforms supported
|
||||
|
||||
- Browser (Chrome 7.0+, FireFox 4.0+, IE 10+, Opera 11.6+, Safari 5.1+)
|
||||
- Node.js 6.0+
|
||||
|
||||
2. API
|
||||
- Basic API: sync and promise-based async
|
||||
- Advanced API: sync and generator-based
|
||||
3. Builds
|
||||
|
||||
- `dist/cjs/image-q.js` - CommonJS
|
||||
- `dist/esm/image-q.js` - ESM (ESNext)
|
||||
- `dist/cjs/image-q.js` - UMD
|
||||
|
||||
4. Import
|
||||
- `HTMLImageElement`
|
||||
- `HTMLCanvasElement`
|
||||
- `NodeCanvas`
|
||||
- `ImageData`
|
||||
- `Array`
|
||||
- `CanvasPixelArray`
|
||||
- `Uint8Array`
|
||||
- `Uint32Array`
|
||||
5. Color Distance
|
||||
|
||||
- `Euclidean` - 1/1/1/1 coefficients (originally used in Xiaolin Wu's Quantizer **WuQuant**)
|
||||
- `EuclideanBT709NoAlpha` - BT.709 sRGB coefficients (originally used in **RGBQuant**)
|
||||
- `EuclideanBT709` BT.709 sRGB coefficients + alpha support
|
||||
- `Manhattan` - 1/1/1/1 coefficients (originally used in **NeuQuant**)
|
||||
- `ManhattanBT709` - BT.709 sRGB coefficients
|
||||
- `ManhattanNommyde` - see https://github.com/igor-bezkrovny/image-quantization/issues/4#issuecomment-234527620
|
||||
- `CIEDE2000` - CIEDE2000 (very slow)
|
||||
- `CIE94Textiles` - CIE94 implementation for textiles
|
||||
- `CIE94GraphicArts` - CIE94 implementation for graphic arts
|
||||
- `CMetric` - see http://www.compuphase.com/cmetric.htm
|
||||
- `PNGQuant` - used in pngQuant tool
|
||||
|
||||
6. Palette Quantizers
|
||||
- `NeuQuant` (original code ported, integer calculations)
|
||||
- `NeuQuantFloat` (floating-point calculations)
|
||||
- `RGBQuant`
|
||||
- `WuQuant`
|
||||
7. Image Quantizers
|
||||
|
||||
- `NearestColor`
|
||||
- `ErrorDiffusionArray` - two modes of error propagation are supported: `xnview` and `gimp`
|
||||
1. `FloydSteinberg`
|
||||
2. `FalseFloydSteinberg`
|
||||
3. `Stucki`
|
||||
4. `Atkinson`
|
||||
5. `Jarvis`
|
||||
6. `Burkes`
|
||||
7. `Sierra`
|
||||
8. `TwoSierra`
|
||||
9. `SierraLite`
|
||||
- `ErrorDiffusionRiemersma` - Hilbert space-filling curve is used
|
||||
|
||||
8. Output
|
||||
- `Uint32Array`
|
||||
- `Uint8Array`
|
||||
|
||||
## Include `image-q` library into your project
|
||||
|
||||
##### ES6 module
|
||||
|
||||
```javascript
|
||||
// will import ESM (ESNext) or UMD version depending on your bundler/node
|
||||
import * as iq from 'image-q';
|
||||
```
|
||||
|
||||
##### CommonJS
|
||||
|
||||
```javascript
|
||||
var iq = require('image-q');
|
||||
```
|
||||
|
||||
##### As a global variable (Browser)
|
||||
|
||||
```html
|
||||
<script
|
||||
src="<path-to image-q/dist/umd/image-q.js>"
|
||||
type="text/javascript"
|
||||
charset="utf-8"
|
||||
></script>
|
||||
```
|
||||
|
||||
## How to use
|
||||
|
||||
Please refer to [API Documentation and Usage](http://ibezkrovnyi.github.io/image-quantization/)
|
||||
|
||||
## Breaking changes
|
||||
|
||||
#### 2.1.1
|
||||
|
||||
+ PaletteQuantizer#quantize => PaletteQuantizer#quantizeSync
|
||||
+ ImageQuantizer#quantize => ImageQuantizer#quantizeSync
|
||||
|
||||
#### 2.0.1 - 2.0.4 (2018-02-22)
|
||||
|
||||
+ EuclideanRgbQuantWOAlpha => EuclideanBT709NoAlpha
|
||||
+ EuclideanRgbQuantWithAlpha => EuclideanBT709
|
||||
+ ManhattanSRGB => ManhattanBT709
|
||||
+ IImageDitherer => AbstractImageQuantizer
|
||||
+ IPaletteQuantizer => AbstractPaletteQuantizer
|
||||
+ PointContainer.fromNodeCanvas => PointContainer.fromHTMLCanvasElement
|
||||
+ PointContainer.fromArray => PointContainer.fromUint8Array
|
||||
+ PointContainer.fromBuffer (Node.js, new)
|
||||
+ CMETRIC => CMetric
|
||||
+ PNGQUANT => PNGQuant
|
||||
+ SSIM Class => ssim function
|
||||
|
||||
## TODO
|
||||
|
||||
1. ~~notification about progress~~
|
||||
2. ~~riemersma dithering~~
|
||||
3. ordered dithering <-- is there anyone who needs it?
|
||||
4. readme update, more examples
|
||||
5. demo update (latest image-q npm version should be used in demo)
|
||||
|
||||
## Changelog
|
||||
|
||||
##### 4.0.0
|
||||
+ Test cases for different types of imports and requres added
|
||||
|
||||
##### 4.0.0-alpha
|
||||
+ Try to solve exported bundle types problem. 'umd' bundle removed.
|
||||
|
||||
##### 3.0.8
|
||||
+ Test case for issue #95 added
|
||||
|
||||
##### 3.0.7
|
||||
+ Fixes #96: Fix minimumColorDistanceToDither (PR #97 by @pixelplanetdev)
|
||||
|
||||
##### 3.0.6
|
||||
+ Fixes #95: "Always empty result in certain webpack / babel configs" (PR #98)
|
||||
|
||||
##### 3.0.4
|
||||
+ Fixes issue "Module not found: Can't resolve 'core-js/fn/set-immediate' in ..."
|
||||
|
||||
##### 3.0.0
|
||||
+ pnpm monorepo, esbuild for faster builds, typescript upgraded
|
||||
|
||||
##### 2.1.1
|
||||
|
||||
+ Basic (Simple) API implemented
|
||||
+ see breaking changes
|
||||
|
||||
##### 2.0.5 (2018-02-23)
|
||||
|
||||
+ @types/node moved to 'dependencies'
|
||||
|
||||
##### 2.0.4 (2018-02-23)
|
||||
|
||||
+ documentation added
|
||||
+ some refactorings/renames, see breaking changes
|
||||
|
||||
##### 2.0.3 (2018-02-22)
|
||||
|
||||
+ circular dependency removed
|
||||
|
||||
##### 2.0.2 (2018-02-22)
|
||||
|
||||
+ readme updated
|
||||
|
||||
##### 2.0.1 (2018-02-22)
|
||||
|
||||
+ progress tracking api (using es6 generators) added
|
||||
+ strinct lint rules (+code cleanup/renames)
|
||||
+ rollup (3 different versions - umd, cjs, esm + source maps + d.ts)
|
||||
+ latest TypeScript
|
||||
+ jest
|
||||
+ snapshot tests
|
||||
+ coverage (+coveralls)
|
||||
+ greenkeeper
|
||||
|
||||
##### 1.1.1 (2016-08-28)
|
||||
|
||||
+ CIEDE2000 - incorrect calculation fixed
|
||||
+ CIEDE2000 - alpha channel now has only 25% impact on color distance instead of 66%
|
||||
+ CIE94 - added 2 types (textiles and graphics art) according to spec
|
||||
+ CIE94 - alpha support added
|
||||
+ rgb2xyz, lab2xyz, xyz2rgb, xyz2lab - gamma correction
|
||||
+ lab2xyz, xyz2lab - refY should be 100 (1.00000) instead of 10 (0.10000)
|
||||
+ manhattan with new (Nommyde) coefficients added
|
||||
+ mocha tests added
|
||||
+ webpack integration
|
||||
+ image-q is now UMD module
|
||||
+ travis-ci integration
|
||||
+ typescript 2.0
|
||||
+ indentation with 4 spaces
|
||||
|
||||
##### 0.1.4 (2015-06-24)
|
||||
|
||||
+ Refactoring
|
||||
+ Riemersma dithering added (Hilbert Curve)
|
||||
+ Readme.md updated
|
||||
+ build.cmd updated
|
||||
|
||||
##### 0.1.3 (2015-06-16)
|
||||
|
||||
+ NeuQuant is fixed (again) according to original Anthony Dekker source code (all values should be integer)
|
||||
+ Error Diffusion Dithering is now calculates error like XNVIEW
|
||||
+ Refactoring
|
||||
|
||||
##### 0.1.2 (2015-06-16)
|
||||
|
||||
+ Documentation generation fixed
|
||||
+ File name case problem fixed
|
||||
|
||||
##### 0.1.1 (2015-06-16)
|
||||
|
||||
+ Auto-generated documentation added
|
||||
+ Refactoring
|
||||
|
||||
##### 0.1.0 (2015-06-16)
|
||||
|
||||
+ Code cleanup, removed unnecessary files
|
||||
|
||||
##### 0.0.5 (2015-06-16)
|
||||
|
||||
+ PNGQuant color distance added, need to check its quality
|
||||
+ CIEDE2000 and CIE94 fixed for use in NeuQuant
|
||||
+ NeuQuant is fixed according to original Anthony Dekker source code (all values should be integer)
|
||||
+ Code refactoring and cleanup
|
||||
* We have some slowdown because of red/green/blue/alpha normalization according to white point per each calculateRaw/calculateNormalized call
|
||||
|
||||
##### 0.0.4 (2015-06-15)
|
||||
|
||||
+ CIEDE2000 color distance equation optimized (original CIEDE2000 equation is available as class `CIEDE2000_Original`)
|
||||
|
||||
##### 0.0.3b (2015-06-11)
|
||||
|
||||
+ CMetric color distance fixed
|
||||
|
||||
##### 0.0.3a (2015-06-11)
|
||||
|
||||
+ Cleanup
|
||||
+ Draft of CMetric color distance added
|
||||
|
||||
##### 0.0.2 (2015-06-10)
|
||||
|
||||
+ rgb2xyz & xyz2lab fixed. CIEDE2000 works much better now.
|
||||
+ CIE94 distance formula added. More investigation is needed.
|
||||
|
||||
##### 0.0.1
|
||||
|
||||
+ Initial
|
||||
|
||||
## Credits
|
||||
|
||||
Thanks to Leon Sorokin for information share and his original RGBQuant!
|
||||
|
||||
## References
|
||||
|
||||
- Palette Quantization Algorithms
|
||||
|
||||
1. [RGBQuant (Leon Sorokin)](https://github.com/leeoniya/RgbQuant.js) `JavaScript`
|
||||
2. [NeuQuant (Johan Nordberg)](https://github.com/jnordberg/gif.js/blob/master/src/TypedNeuQuant.js) `TypeScript`
|
||||
3. [NeuQuant (Tim Oxley)](https://github.com/timoxley/neuquant) `JavaScript`
|
||||
4. [NeuQuant (Devon Govett)](https://github.com/devongovett/neuquant) `JavaScript`
|
||||
5. [NeuQuant32 (Stuart Coyle)](https://github.com/stuart/pngnq/blob/master/src/neuquant32.c) `C`
|
||||
6. [Xiaolin Wu (Xiaolin Wu)](http://www.ece.mcmaster.ca/~xwu/cq.c) `C`
|
||||
7. [Xiaolin Wu (Smart-K8)](http://www.codeproject.com/Articles/66341/A-Simple-Yet-Quite-Powerful-Palette-Quantizer-in-C) `C#`
|
||||
8. Xiaolin Wu w/ Alpha (Matt Wrock) [How to add Alpha](https://code.msdn.microsoft.com/windowsdesktop/Convert-32-bit-PNGs-to-81ef8c81/view/SourceCode#content), [Source Code](https://nquant.codeplex.com) `C#`
|
||||
9. [MedianCut (mwcz)](https://github.com/mwcz/median-cut-js) `GPLv3`
|
||||
|
||||
- Image Quantization Algorithms
|
||||
|
||||
1. [All (ImageMagik doc)](http://www.imagemagick.org/Usage/quantize/#dither)
|
||||
2. [Error Diffusion dithering (Tanner Helland)](http://www.tannerhelland.com/4660/dithering-eleven-algorithms-source-code)
|
||||
3. [Riemersma dithering](http://www.compuphase.com/riemer.htm) `TODO: Check License`
|
||||
4. [Ordered dithering (Joel Yliluoma)](http://bisqwit.iki.fi/story/howto/dither/jy)
|
||||
|
||||
- Color Distance Formulas
|
||||
|
||||
[Calculator + Info](http://colorizer.org/)
|
||||
|
||||
1. Euclidean Distance
|
||||
2. Manhattan Distance
|
||||
3. CIE94 Distance
|
||||
- [Source Code (Iulius Curt)](https://github.com/iuliux/CIE94.js)
|
||||
4. CIEDE2000
|
||||
- [Math and Test Data Table (PDF)](http://www.ece.rochester.edu/~gsharma/ciede2000/ciede2000noteCRNA.pdf)
|
||||
- [Info](http://www.ece.rochester.edu/~gsharma/ciede2000/)
|
||||
- [Source Code (Greg Fiumara)](https://github.com/gfiumara/CIEDE2000) `C`
|
||||
- [Source Code (THEjoezack)](https://github.com/THEjoezack/ColorMine/blob/master/ColorMine/ColorSpaces/Comparisons/CieDe2000Comparison.cs) `C#`
|
||||
- [Online Calculator](http://colormine.org/delta-e-calculator/cie2000)
|
||||
5. Euclidean Distance w/o Alpha (RGBQuant)
|
||||
6. Euclidean Distance w/o sRGB coefficients (Xiaolin Wu Quant)
|
||||
7. Manhattan Distance w/o sRGB coefficients (NeuQuant)
|
||||
8. [CMetric](http://www.compuphase.com/cmetric.htm) `DRAFT!`
|
||||
|
||||
- Color conversion formulas
|
||||
|
||||
1. [Pseudo-code](http://www.easyrgb.com/?X=MATH)
|
||||
|
||||
> Be sure to fix rgb2xyz/xyz2lab. Issue is with strange part of code: `r = r > 0.04045 ? ...`. Check http://en.wikipedia.org/wiki/Lab_color_space
|
||||
|
||||
- Image Quality Assessment
|
||||
|
||||
1. [SSIM info](http://en.wikipedia.org/wiki/Structural_similarity)
|
||||
2. [SSIM (Rhys-e)](https://github.com/rhys-e/structural-similarity) `Java` `License: MIT`
|
||||
3. PSNR ? TBD
|
||||
4. MSE ? TBD
|
||||
|
||||
- Other
|
||||
|
||||
1. [HUSL (Boronine) - info](http://www.husl-colors.org)
|
||||
2. [HUSL (Boronine) - code](https://github.com/husl-colors/husl)
|
||||
3. [Color Image Quantization for Frame Buffer Display](https://www.cs.cmu.edu/~ph/ciq_thesis)
|
||||
4. [K-Means](http://arxiv.org/pdf/1101.0395.pdf)
|
||||
5. [Efficient Color Quantization by Hierarchical Clustering Algorithms](ftp://cs.joensuu.fi/pub/Theses/2005_MSc_Hautamaki_Ville.pdf)
|
||||
6. http://www.codeproject.com/Articles/66341/A-Simple-Yet-Quite-Powerful-Palette-Quantizer-in-C
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
+2921
File diff suppressed because it is too large.
Load diff
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../src/index.ts", "../../src/constants/index.ts", "../../src/constants/bt709.ts", "../../src/conversion/index.ts", "../../src/conversion/rgb2xyz.ts", "../../src/utils/arithmetic.ts", "../../src/conversion/rgb2hsl.ts", "../../src/conversion/xyz2lab.ts", "../../src/conversion/rgb2lab.ts", "../../src/conversion/lab2xyz.ts", "../../src/conversion/xyz2rgb.ts", "../../src/conversion/lab2rgb.ts", "../../src/distance/index.ts", "../../src/distance/distanceCalculator.ts", "../../src/distance/cie94.ts", "../../src/distance/ciede2000.ts", "../../src/distance/cmetric.ts", "../../src/distance/euclidean.ts", "../../src/distance/manhattan.ts", "../../src/distance/pngQuant.ts", "../../src/palette/index.ts", "../../src/palette/paletteQuantizer.ts", "../../src/utils/point.ts", "../../src/utils/pointContainer.ts", "../../src/utils/palette.ts", "../../src/utils/index.ts", "../../src/utils/hueStatistics.ts", "../../src/utils/progressTracker.ts", "../../src/palette/neuquant/neuquant.ts", "../../src/palette/neuquant/neuquantFloat.ts", "../../src/palette/rgbquant/colorHistogram.ts", "../../src/palette/rgbquant/rgbquant.ts", "../../src/palette/wu/wuQuant.ts", "../../src/image/index.ts", "../../src/image/imageQuantizer.ts", "../../src/image/nearestColor.ts", "../../src/image/array.ts", "../../src/image/spaceFillingCurves/hilbertCurve.ts", "../../src/image/riemersma.ts", "../../src/quality/index.ts", "../../src/quality/ssim.ts", "../../src/basicAPI.ts"],
|
||||
"sourcesContent": ["/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * iq.ts - Image Quantization Library\n */\nimport * as constants from './constants';\nimport * as conversion from './conversion';\nimport * as distance from './distance';\nimport * as palette from './palette';\nimport * as image from './image';\nimport * as quality from './quality';\nimport * as utils from './utils';\n\nexport {\n buildPalette,\n buildPaletteSync,\n applyPalette,\n applyPaletteSync,\n} from './basicAPI';\n\nexport type {\n ImageQuantization,\n PaletteQuantization,\n ColorDistanceFormula,\n} from './basicAPI';\n\nexport { constants, conversion, distance, palette, image, quality, utils };\n", "/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * constants.ts - part of Image Quantization Library\n */\nimport * as bt709 from './bt709';\n\nexport { bt709 };\n", "/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * constants.ts - part of Image Quantization Library\n */\n\n/**\n * sRGB (based on ITU-R Recommendation BT.709)\n * http://en.wikipedia.org/wiki/SRGB\n */\nexport enum Y {\n RED = 0.2126,\n GREEN = 0.7152,\n BLUE = 0.0722,\n WHITE = 1,\n}\n\nexport enum x {\n RED = 0.64,\n GREEN = 0.3,\n BLUE = 0.15,\n WHITE = 0.3127,\n}\n\nexport enum y {\n RED = 0.33,\n GREEN = 0.6,\n BLUE = 0.06,\n WHITE = 0.329,\n}\n", "/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * iq.ts - Image Quantization Library\n */\nexport { rgb2xyz } from './rgb2xyz';\nexport { rgb2hsl } from './rgb2hsl';\nexport { rgb2lab } from './rgb2lab';\nexport { lab2xyz } from './lab2xyz';\nexport { lab2rgb } from './lab2rgb';\nexport { xyz2lab } from './xyz2lab';\nexport { xyz2rgb } from './xyz2rgb';\n", "/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * rgb2xyz.ts - part of Image Quantization Library\n */\nfunction correctGamma(n: number) {\n return n > 0.04045 ? ((n + 0.055) / 1.055) ** 2.4 : n / 12.92;\n}\n\nexport function rgb2xyz(r: number, g: number, b: number) {\n // gamma correction, see https://en.wikipedia.org/wiki/SRGB#The_reverse_transformation\n r = correctGamma(r / 255);\n g = correctGamma(g / 255);\n b = correctGamma(b / 255);\n\n // Observer. = 2\u00B0, Illuminant = D65\n return {\n x: r * 0.4124 + g * 0.3576 + b * 0.1805,\n y: r * 0.2126 + g * 0.7152 + b * 0.0722,\n z: r * 0.0193 + g * 0.1192 + b * 0.9505,\n };\n}\n", "export function degrees2radians(n: number) {\n return n * (Math.PI / 180);\n}\n\nexport function max3(a: number, b: number, c: number) {\n let m = a;\n if (m < b) m = b;\n if (m < c) m = c;\n return m;\n}\n\nexport function min3(a: number, b: number, c: number) {\n let m = a;\n if (m > b) m = b;\n if (m > c) m = c;\n return m;\n}\n\nexport function intInRange(value: number, low: number, high: number) {\n if (value > high) value = high;\n if (value < low) value = low;\n return value | 0;\n}\n\nexport function inRange0to255Rounded(n: number) {\n n = Math.round(n);\n if (n > 255) n = 255;\n else if (n < 0) n = 0;\n return n;\n}\n\nexport function inRange0to255(n: number) {\n if (n > 255) n = 255;\n else if (n < 0) n = 0;\n return n;\n}\n\nexport function stableSort<T>(\n arrayToSort: T[],\n callback: (a: T, b: T) => number,\n) {\n const type = typeof arrayToSort[0];\n let sorted: T[];\n\n if (type === 'number' || type === 'string') {\n const ord = Object.create(null);\n for (let i = 0, l = arrayToSort.length; i < l; i++) {\n const val = arrayToSort[i] as unknown as string;\n if (ord[val] || ord[val] === 0) continue;\n ord[val] = i;\n }\n\n sorted = arrayToSort.sort((a, b) => callback(a, b) || ord[a] - ord[b]);\n } else {\n const ord2 = arrayToSort.slice(0);\n sorted = arrayToSort.sort(\n (a, b) => callback(a, b) || ord2.indexOf(a) - ord2.indexOf(b),\n );\n }\n\n return sorted;\n}\n", "/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * rgb2hsl.ts - part of Image Quantization Library\n */\nimport { min3, max3 } from '../utils/arithmetic';\n\n/**\n * Calculate HSL from RGB\n * Hue is in degrees [0..360]\n * Lightness: [0..1]\n * Saturation: [0..1]\n * http://web.archive.org/web/20060914040436/http://local.wasp.uwa.edu.au/~pbourke/colour/hsl/\n */\nexport function rgb2hsl(r: number, g: number, b: number) {\n const min = min3(r, g, b);\n const max = max3(r, g, b);\n const delta = max - min;\n const l = (min + max) / 510;\n\n let s = 0;\n if (l > 0 && l < 1) s = delta / (l < 0.5 ? max + min : 510 - max - min);\n\n let h = 0;\n if (delta > 0) {\n if (max === r) {\n h = (g - b) / delta;\n } else if (max === g) {\n h = 2 + (b - r) / delta;\n } else {\n h = 4 + (r - g) / delta;\n }\n\Line truncated
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,IAAK,IAAL,kBAAK,OAAL;AACL,iBAAM,UAAN;AACA,mBAAQ,UAAR;AACA,kBAAO,UAAP;AACA,mBAAQ,KAAR;AAJU;AAAA;AAOL,IAAK,IAAL,kBAAK,OAAL;AACL,iBAAM,QAAN;AACA,mBAAQ,OAAR;AACA,kBAAO,QAAP;AACA,mBAAQ,UAAR;AAJU;AAAA;AAOL,IAAK,IAAL,kBAAK,OAAL;AACL,iBAAM,QAAN;AACA,mBAAQ,OAAR;AACA,kBAAO,QAAP;AACA,mBAAQ,SAAR;AAJU;AAAA;AD1BZ;;AEAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,AAOA,sBAAsB,GAAW;AAC/B,SAAO,IAAI,UAAY,MAAI,SAAS,UAAU,MAAM,IAAI;AAAA;AAGnD,iBAAiB,GAAW,GAAW,GAAW;AAEvD,MAAI,aAAa,IAAI;AACrB,MAAI,aAA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O,KAAK,KACT,MAAK,KAAK,QAAQ,IAChB,MAAM,KAAM,KAAK,MAAM,QAAQ,IAC/B,UAAU,KAAM,KAAK,MAAM,QAAQ,IACpC,UAAU;AAAA;AAAA;AAKX,kCAA4B,cAAc;AAAA,EACrC,eAAe;AACvB,SALine truncated
|
||||
"names": []
|
||||
}
|
||||
+2886
File diff suppressed because it is too large.
Load diff
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../src/constants/index.ts", "../../src/constants/bt709.ts", "../../src/conversion/index.ts", "../../src/conversion/rgb2xyz.ts", "../../src/utils/arithmetic.ts", "../../src/conversion/rgb2hsl.ts", "../../src/conversion/xyz2lab.ts", "../../src/conversion/rgb2lab.ts", "../../src/conversion/lab2xyz.ts", "../../src/conversion/xyz2rgb.ts", "../../src/conversion/lab2rgb.ts", "../../src/distance/index.ts", "../../src/distance/distanceCalculator.ts", "../../src/distance/cie94.ts", "../../src/distance/ciede2000.ts", "../../src/distance/cmetric.ts", "../../src/distance/euclidean.ts", "../../src/distance/manhattan.ts", "../../src/distance/pngQuant.ts", "../../src/palette/index.ts", "../../src/palette/paletteQuantizer.ts", "../../src/utils/point.ts", "../../src/utils/pointContainer.ts", "../../src/utils/palette.ts", "../../src/utils/index.ts", "../../src/utils/hueStatistics.ts", "../../src/utils/progressTracker.ts", "../../src/palette/neuquant/neuquant.ts", "../../src/palette/neuquant/neuquantFloat.ts", "../../src/palette/rgbquant/colorHistogram.ts", "../../src/palette/rgbquant/rgbquant.ts", "../../src/palette/wu/wuQuant.ts", "../../src/image/index.ts", "../../src/image/imageQuantizer.ts", "../../src/image/nearestColor.ts", "../../src/image/array.ts", "../../src/image/spaceFillingCurves/hilbertCurve.ts", "../../src/image/riemersma.ts", "../../src/quality/index.ts", "../../src/quality/ssim.ts", "../../src/basicAPI.ts", "../../src/index.ts"],
|
||||
"sourcesContent": ["/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * constants.ts - part of Image Quantization Library\n */\nimport * as bt709 from './bt709';\n\nexport { bt709 };\n", "/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * constants.ts - part of Image Quantization Library\n */\n\n/**\n * sRGB (based on ITU-R Recommendation BT.709)\n * http://en.wikipedia.org/wiki/SRGB\n */\nexport enum Y {\n RED = 0.2126,\n GREEN = 0.7152,\n BLUE = 0.0722,\n WHITE = 1,\n}\n\nexport enum x {\n RED = 0.64,\n GREEN = 0.3,\n BLUE = 0.15,\n WHITE = 0.3127,\n}\n\nexport enum y {\n RED = 0.33,\n GREEN = 0.6,\n BLUE = 0.06,\n WHITE = 0.329,\n}\n", "/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * iq.ts - Image Quantization Library\n */\nexport { rgb2xyz } from './rgb2xyz';\nexport { rgb2hsl } from './rgb2hsl';\nexport { rgb2lab } from './rgb2lab';\nexport { lab2xyz } from './lab2xyz';\nexport { lab2rgb } from './lab2rgb';\nexport { xyz2lab } from './xyz2lab';\nexport { xyz2rgb } from './xyz2rgb';\n", "/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * rgb2xyz.ts - part of Image Quantization Library\n */\nfunction correctGamma(n: number) {\n return n > 0.04045 ? ((n + 0.055) / 1.055) ** 2.4 : n / 12.92;\n}\n\nexport function rgb2xyz(r: number, g: number, b: number) {\n // gamma correction, see https://en.wikipedia.org/wiki/SRGB#The_reverse_transformation\n r = correctGamma(r / 255);\n g = correctGamma(g / 255);\n b = correctGamma(b / 255);\n\n // Observer. = 2\u00B0, Illuminant = D65\n return {\n x: r * 0.4124 + g * 0.3576 + b * 0.1805,\n y: r * 0.2126 + g * 0.7152 + b * 0.0722,\n z: r * 0.0193 + g * 0.1192 + b * 0.9505,\n };\n}\n", "export function degrees2radians(n: number) {\n return n * (Math.PI / 180);\n}\n\nexport function max3(a: number, b: number, c: number) {\n let m = a;\n if (m < b) m = b;\n if (m < c) m = c;\n return m;\n}\n\nexport function min3(a: number, b: number, c: number) {\n let m = a;\n if (m > b) m = b;\n if (m > c) m = c;\n return m;\n}\n\nexport function intInRange(value: number, low: number, high: number) {\n if (value > high) value = high;\n if (value < low) value = low;\n return value | 0;\n}\n\nexport function inRange0to255Rounded(n: number) {\n n = Math.round(n);\n if (n > 255) n = 255;\n else if (n < 0) n = 0;\n return n;\n}\n\nexport function inRange0to255(n: number) {\n if (n > 255) n = 255;\n else if (n < 0) n = 0;\n return n;\n}\n\nexport function stableSort<T>(\n arrayToSort: T[],\n callback: (a: T, b: T) => number,\n) {\n const type = typeof arrayToSort[0];\n let sorted: T[];\n\n if (type === 'number' || type === 'string') {\n const ord = Object.create(null);\n for (let i = 0, l = arrayToSort.length; i < l; i++) {\n const val = arrayToSort[i] as unknown as string;\n if (ord[val] || ord[val] === 0) continue;\n ord[val] = i;\n }\n\n sorted = arrayToSort.sort((a, b) => callback(a, b) || ord[a] - ord[b]);\n } else {\n const ord2 = arrayToSort.slice(0);\n sorted = arrayToSort.sort(\n (a, b) => callback(a, b) || ord2.indexOf(a) - ord2.indexOf(b),\n );\n }\n\n return sorted;\n}\n", "/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * rgb2hsl.ts - part of Image Quantization Library\n */\nimport { min3, max3 } from '../utils/arithmetic';\n\n/**\n * Calculate HSL from RGB\n * Hue is in degrees [0..360]\n * Lightness: [0..1]\n * Saturation: [0..1]\n * http://web.archive.org/web/20060914040436/http://local.wasp.uwa.edu.au/~pbourke/colour/hsl/\n */\nexport function rgb2hsl(r: number, g: number, b: number) {\n const min = min3(r, g, b);\n const max = max3(r, g, b);\n const delta = max - min;\n const l = (min + max) / 510;\n\n let s = 0;\n if (l > 0 && l < 1) s = delta / (l < 0.5 ? max + min : 510 - max - min);\n\n let h = 0;\n if (delta > 0) {\n if (max === r) {\n h = (g - b) / delta;\n } else if (max === g) {\n h = 2 + (b - r) / delta;\n } else {\n h = 4 + (r - g) / delta;\n }\n\n h *= 60;\n if (h < 0) h += 360;\n }\n return { h, s, l };\n}\n", "/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * xyz2lab.ts - part of Image Quantization Library\n */\nconst refX = 0.95047; // ref_X = 95.047 Observer= 2\u00B0, Illuminant= D65\nconst refY = 1.0; // ref_Y = 100.000\nconst refZ = 1.08883; // ref_Z = 108.883\n\nfunction pivot(n: number) {\n return n > 0.008856 ? n ** (1 / 3) : 7.787 * n + 16 / 116;\n}\n\nexport function xyz2lab(x: number, y: number, z: number) {\n x = pivot(x / refX);\n y = pivot(y / refY);\n z = pivot(z / refZ);\n\n if (116 * y - 16 < 0) throw new Error('xxx');\n return {\n L: Math.max(0, 116 * y - 16),\n Line truncated
|
||||
"mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,IAAK,IAAL,kBAAK,OAAL;AACL,iBAAM,UAAN;AACA,mBAAQ,UAAR;AACA,kBAAO,UAAP;AACA,mBAAQ,KAAR;AAJU;AAAA;AAOL,IAAK,IAAL,kBAAK,OAAL;AACL,iBAAM,QAAN;AACA,mBAAQ,OAAR;AACA,kBAAO,QAAP;AACA,mBAAQ,UAAR;AAJU;AAAA;AAOL,IAAK,IAAL,kBAAK,OAAL;AACL,iBAAM,QAAN;AACA,mBAAQ,OAAR;AACA,kBAAO,QAAP;AACA,mBAAQ,SAAR;AAJU;AAAA;AD1BZ;;AEAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,AAOA,sBAAsB,GAAW;AAC/B,SAAO,IAAI,UAAY,MAAI,SAAS,UAAU,MAAM,IAAI;AAAA;AAGnD,iBAAiB,GAAW,GAAW,GAAW;AA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AM,KAAK,YAAY,IAAI,KAAK;AAGrD,WAAO,KAAK,KACT,MAAK,KAAK,QAAQ,IAChB,MAAM,KAAM,KAAK,MAAM,QAAQ,IAC/B,UAAU,KAAM,KAAK,MAAM,QAAQ,IACpC,UAAU;AAAA;AAAA;AAKX,kCAA4B,cAAc;AAAA,EACrC,eAAe;AACvB,SAAK,MAAM;AACX,SAAK,MAAM;AACX,SAAK,MAAM;AACX,SAAK,MAAO,OAAO,KAAM;AAAA;AAAA;AAItB,qCAA+B,cAALine truncated
|
||||
"names": []
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
import { PointContainer } from './utils/pointContainer';
|
||||
import { Palette } from './utils/palette';
|
||||
export declare type ColorDistanceFormula = 'cie94-textiles' | 'cie94-graphic-arts' | 'ciede2000' | 'color-metric' | 'euclidean' | 'euclidean-bt709-noalpha' | 'euclidean-bt709' | 'manhattan' | 'manhattan-bt709' | 'manhattan-nommyde' | 'pngquant';
|
||||
export declare type PaletteQuantization = 'neuquant' | 'neuquant-float' | 'rgbquant' | 'wuquant';
|
||||
export declare type ImageQuantization = 'nearest' | 'riemersma' | 'floyd-steinberg' | 'false-floyd-steinberg' | 'stucki' | 'atkinson' | 'jarvis' | 'burkes' | 'sierra' | 'two-sierra' | 'sierra-lite';
|
||||
export interface ProgressOptions {
|
||||
onProgress?: (progress: number) => void;
|
||||
}
|
||||
export interface ApplyPaletteOptions {
|
||||
colorDistanceFormula?: ColorDistanceFormula;
|
||||
imageQuantization?: ImageQuantization;
|
||||
}
|
||||
export interface BuildPaletteOptions {
|
||||
colorDistanceFormula?: ColorDistanceFormula;
|
||||
paletteQuantization?: PaletteQuantization;
|
||||
colors?: number;
|
||||
}
|
||||
export declare function buildPaletteSync(images: PointContainer[], { colorDistanceFormula, paletteQuantization, colors, }?: BuildPaletteOptions): Palette;
|
||||
export declare function buildPalette(images: PointContainer[], { colorDistanceFormula, paletteQuantization, colors, onProgress, }?: BuildPaletteOptions & ProgressOptions): Promise<Palette>;
|
||||
export declare function applyPaletteSync(image: PointContainer, palette: Palette, { colorDistanceFormula, imageQuantization }?: ApplyPaletteOptions): PointContainer;
|
||||
export declare function applyPalette(image: PointContainer, palette: Palette, { colorDistanceFormula, imageQuantization, onProgress, }?: ApplyPaletteOptions & ProgressOptions): Promise<PointContainer>;
|
||||
//# sourceMappingURL=basicAPI.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"basicAPI.d.ts","sourceRoot":"","sources":["../../../src/basicAPI.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAS1C,oBAAY,oBAAoB,GAC5B,gBAAgB,GAChB,oBAAoB,GACpB,WAAW,GACX,cAAc,GACd,WAAW,GACX,yBAAyB,GACzB,iBAAiB,GACjB,WAAW,GACX,iBAAiB,GACjB,mBAAmB,GACnB,UAAU,CAAC;AAEf,oBAAY,mBAAmB,GAC3B,UAAU,GACV,gBAAgB,GAChB,UAAU,GACV,SAAS,CAAC;AAEd,oBAAY,iBAAiB,GACzB,SAAS,GACT,WAAW,GACX,iBAAiB,GACjB,uBAAuB,GACvB,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,aAAa,CAAC;AAElB,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,mBAAmB;IAClC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED,MAAM,WAAW,mBAAmB;IAClC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,cAAc,EAAE,EACxB,EACE,oBAAoB,EACpB,mBAAmB,EACnB,MAAM,GACP,GAAE,mBAAwB,WAW5B;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,cAAc,EAAE,EACxB,EACE,oBAAoB,EACpB,mBAAmB,EACnB,MAAM,EACN,UAAU,GACX,GAAE,mBAAmB,GAAG,eAAoB,oBA8B9C;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,OAAO,EAChB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,GAAE,mBAAwB,kBAStE;AAED,wBAAsB,YAAY,CAChC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,OAAO,EAChB,EACE,oBAAoB,EACpB,iBAAiB,EACjB,UAAU,GACX,GAAE,mBAAmB,GAAG,eAAoB,2BA8B9C"}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* constants.ts - part of Image Quantization Library
|
||||
*/
|
||||
/**
|
||||
* sRGB (based on ITU-R Recommendation BT.709)
|
||||
* http://en.wikipedia.org/wiki/SRGB
|
||||
*/
|
||||
export declare enum Y {
|
||||
RED = 0.2126,
|
||||
GREEN = 0.7152,
|
||||
BLUE = 0.0722,
|
||||
WHITE = 1
|
||||
}
|
||||
export declare enum x {
|
||||
RED = 0.64,
|
||||
GREEN = 0.3,
|
||||
BLUE = 0.15,
|
||||
WHITE = 0.3127
|
||||
}
|
||||
export declare enum y {
|
||||
RED = 0.33,
|
||||
GREEN = 0.6,
|
||||
BLUE = 0.06,
|
||||
WHITE = 0.329
|
||||
}
|
||||
//# sourceMappingURL=bt709.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bt709.d.ts","sourceRoot":"","sources":["../../../../src/constants/bt709.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,oBAAY,CAAC;IACX,GAAG,SAAS;IACZ,KAAK,SAAS;IACd,IAAI,SAAS;IACb,KAAK,IAAI;CACV;AAED,oBAAY,CAAC;IACX,GAAG,OAAO;IACV,KAAK,MAAM;IACX,IAAI,OAAO;IACX,KAAK,SAAS;CACf;AAED,oBAAY,CAAC;IACX,GAAG,OAAO;IACV,KAAK,MAAM;IACX,IAAI,OAAO;IACX,KAAK,QAAQ;CACd"}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* constants.ts - part of Image Quantization Library
|
||||
*/
|
||||
import * as bt709 from './bt709';
|
||||
export { bt709 };
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/constants/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* iq.ts - Image Quantization Library
|
||||
*/
|
||||
export { rgb2xyz } from './rgb2xyz';
|
||||
export { rgb2hsl } from './rgb2hsl';
|
||||
export { rgb2lab } from './rgb2lab';
|
||||
export { lab2xyz } from './lab2xyz';
|
||||
export { lab2rgb } from './lab2rgb';
|
||||
export { xyz2lab } from './xyz2lab';
|
||||
export { xyz2rgb } from './xyz2rgb';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/conversion/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
export declare function lab2rgb(L: number, a: number, b: number): {
|
||||
r: number;
|
||||
g: number;
|
||||
b: number;
|
||||
};
|
||||
//# sourceMappingURL=lab2rgb.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"lab2rgb.d.ts","sourceRoot":"","sources":["../../../../src/conversion/lab2rgb.ts"],"names":[],"mappings":"AAUA,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;;;EAGtD"}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
export declare function lab2xyz(L: number, a: number, b: number): {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
};
|
||||
//# sourceMappingURL=lab2xyz.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"lab2xyz.d.ts","sourceRoot":"","sources":["../../../../src/conversion/lab2xyz.ts"],"names":[],"mappings":"AAeA,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;;;EAUtD"}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Calculate HSL from RGB
|
||||
* Hue is in degrees [0..360]
|
||||
* Lightness: [0..1]
|
||||
* Saturation: [0..1]
|
||||
* http://web.archive.org/web/20060914040436/http://local.wasp.uwa.edu.au/~pbourke/colour/hsl/
|
||||
*/
|
||||
export declare function rgb2hsl(r: number, g: number, b: number): {
|
||||
h: number;
|
||||
s: number;
|
||||
l: number;
|
||||
};
|
||||
//# sourceMappingURL=rgb2hsl.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"rgb2hsl.d.ts","sourceRoot":"","sources":["../../../../src/conversion/rgb2hsl.ts"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;;;EAuBtD"}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
export declare function rgb2lab(r: number, g: number, b: number): {
|
||||
L: number;
|
||||
a: number;
|
||||
b: number;
|
||||
};
|
||||
//# sourceMappingURL=rgb2lab.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"rgb2lab.d.ts","sourceRoot":"","sources":["../../../../src/conversion/rgb2lab.ts"],"names":[],"mappings":"AAUA,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;;;EAGtD"}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
export declare function rgb2xyz(r: number, g: number, b: number): {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
};
|
||||
//# sourceMappingURL=rgb2xyz.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"rgb2xyz.d.ts","sourceRoot":"","sources":["../../../../src/conversion/rgb2xyz.ts"],"names":[],"mappings":"AAWA,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;;;EAYtD"}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
export declare function xyz2lab(x: number, y: number, z: number): {
|
||||
L: number;
|
||||
a: number;
|
||||
b: number;
|
||||
};
|
||||
//# sourceMappingURL=xyz2lab.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"xyz2lab.d.ts","sourceRoot":"","sources":["../../../../src/conversion/xyz2lab.ts"],"names":[],"mappings":"AAeA,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;;;EAWtD"}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
export declare function xyz2rgb(x: number, y: number, z: number): {
|
||||
r: number;
|
||||
g: number;
|
||||
b: number;
|
||||
};
|
||||
//# sourceMappingURL=xyz2rgb.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"xyz2rgb.d.ts","sourceRoot":"","sources":["../../../../src/conversion/xyz2rgb.ts"],"names":[],"mappings":"AAcA,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;;;EAWtD"}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* cie94.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { AbstractDistanceCalculator } from './distanceCalculator';
|
||||
/**
|
||||
* CIE94 method of delta-e
|
||||
* http://en.wikipedia.org/wiki/Color_difference#CIE94
|
||||
*/
|
||||
export declare abstract class AbstractCIE94 extends AbstractDistanceCalculator {
|
||||
/**
|
||||
* Weight in distance: 0.25
|
||||
* Max DeltaE: 100
|
||||
* Max DeltaA: 255
|
||||
*/
|
||||
protected _kA: number;
|
||||
protected _Kl: number;
|
||||
protected _K1: number;
|
||||
protected _K2: number;
|
||||
calculateRaw(r1: number, g1: number, b1: number, a1: number, r2: number, g2: number, b2: number, a2: number): number;
|
||||
}
|
||||
export declare class CIE94Textiles extends AbstractCIE94 {
|
||||
protected _setDefaults(): void;
|
||||
}
|
||||
export declare class CIE94GraphicArts extends AbstractCIE94 {
|
||||
protected _setDefaults(): void;
|
||||
}
|
||||
//# sourceMappingURL=cie94.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cie94.d.ts","sourceRoot":"","sources":["../../../../src/distance/cie94.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAIlE;;;GAGG;AACH,8BAAsB,aAAc,SAAQ,0BAA0B;IACpE;;;;OAIG;IACH,UAAkB,GAAG,EAAE,MAAM,CAAC;IAC9B,UAAkB,GAAG,EAAE,MAAM,CAAC;IAC9B,UAAkB,GAAG,EAAE,MAAM,CAAC;IAC9B,UAAkB,GAAG,EAAE,MAAM,CAAC;IAE9B,YAAY,CACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM;CAiCb;AAED,qBAAa,aAAc,SAAQ,aAAa;IAC9C,SAAS,CAAC,YAAY;CAMvB;AAED,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,SAAS,CAAC,YAAY;CAMvB"}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* ciede2000.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { AbstractDistanceCalculator } from './distanceCalculator';
|
||||
/**
|
||||
* CIEDE2000 algorithm - Adapted from Sharma et al's MATLAB implementation at
|
||||
* http://www.ece.rochester.edu/~gsharma/ciede2000/
|
||||
*/
|
||||
export declare class CIEDE2000 extends AbstractDistanceCalculator {
|
||||
/**
|
||||
* Weight in distance: 0.25
|
||||
* Max DeltaE: 100
|
||||
* Max DeltaA: 255
|
||||
*/
|
||||
private static readonly _kA;
|
||||
private static readonly _pow25to7;
|
||||
private static readonly _deg360InRad;
|
||||
private static readonly _deg180InRad;
|
||||
private static readonly _deg30InRad;
|
||||
private static readonly _deg6InRad;
|
||||
private static readonly _deg63InRad;
|
||||
private static readonly _deg275InRad;
|
||||
private static readonly _deg25InRad;
|
||||
protected _setDefaults(): void;
|
||||
private static _calculatehp;
|
||||
private static _calculateRT;
|
||||
private static _calculateT;
|
||||
private static _calculate_ahp;
|
||||
private static _calculate_dHp;
|
||||
calculateRaw(r1: number, g1: number, b1: number, a1: number, r2: number, g2: number, b2: number, a2: number): number;
|
||||
calculateRawInLab(Lab1: {
|
||||
L: number;
|
||||
a: number;
|
||||
b: number;
|
||||
}, Lab2: {
|
||||
L: number;
|
||||
a: number;
|
||||
b: number;
|
||||
}): number;
|
||||
}
|
||||
//# sourceMappingURL=ciede2000.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ciede2000.d.ts","sourceRoot":"","sources":["../../../../src/distance/ciede2000.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAIlE;;;GAGG;AACH,qBAAa,SAAU,SAAQ,0BAA0B;IACvD;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAsB;IACjD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAW;IAC5C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAwB;IAC5D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAwB;IAC5D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAuB;IAC1D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAsB;IACxD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAuB;IAC1D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAwB;IAC5D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAuB;IAE1D,SAAS,CAAC,YAAY;IAEtB,OAAO,CAAC,MAAM,CAAC,YAAY;IAM3B,OAAO,CAAC,MAAM,CAAC,YAAY;IAW3B,OAAO,CAAC,MAAM,CAAC,WAAW;IAU1B,OAAO,CAAC,MAAM,CAAC,cAAc;IAe7B,OAAO,CAAC,MAAM,CAAC,cAAc;IAmB7B,YAAY,CACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM;IAkBZ,iBAAiB,CACf,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,EACzC,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;CAuD5C"}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* cmetric.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { AbstractDistanceCalculator } from './distanceCalculator';
|
||||
/**
|
||||
* TODO: Name it: http://www.compuphase.com/cmetric.htm
|
||||
*/
|
||||
export declare class CMetric extends AbstractDistanceCalculator {
|
||||
calculateRaw(r1: number, g1: number, b1: number, a1: number, r2: number, g2: number, b2: number, a2: number): number;
|
||||
protected _setDefaults(): void;
|
||||
}
|
||||
//# sourceMappingURL=cmetric.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cmetric.d.ts","sourceRoot":"","sources":["../../../../src/distance/cmetric.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE;;GAEG;AACH,qBAAa,OAAQ,SAAQ,0BAA0B;IACrD,YAAY,CACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM;IAeZ,SAAS,CAAC,YAAY;CACvB"}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* common.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { PointRGBA } from '../utils/point';
|
||||
export declare abstract class AbstractDistanceCalculator {
|
||||
protected _maxDistance: number;
|
||||
protected _whitePoint: {
|
||||
r: number;
|
||||
g: number;
|
||||
b: number;
|
||||
a: number;
|
||||
};
|
||||
constructor();
|
||||
setWhitePoint(r: number, g: number, b: number, a: number): void;
|
||||
calculateNormalized(colorA: PointRGBA, colorB: PointRGBA): number;
|
||||
/**
|
||||
* Calculate raw distance (non-normalized)
|
||||
*/
|
||||
abstract calculateRaw(r1: number, g1: number, b1: number, a1: number, r2: number, g2: number, b2: number, a2: number): number;
|
||||
protected abstract _setDefaults(): void;
|
||||
}
|
||||
//# sourceMappingURL=distanceCalculator.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"distanceCalculator.d.ts","sourceRoot":"","sources":["../../../../src/distance/distanceCalculator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,8BAAsB,0BAA0B;IAC9C,SAAS,CAAC,YAAY,EAAG,MAAM,CAAC;IAChC,SAAS,CAAC,WAAW,EAAG;QACtB,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;;IASF,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAUxD,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS;IAexD;;OAEG;IACH,QAAQ,CAAC,YAAY,CACnB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,GACT,MAAM;IAET,SAAS,CAAC,QAAQ,CAAC,YAAY,IAAI,IAAI;CACxC"}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* euclidean.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { AbstractDistanceCalculator } from './distanceCalculator';
|
||||
/**
|
||||
* Euclidean color distance
|
||||
*/
|
||||
export declare abstract class AbstractEuclidean extends AbstractDistanceCalculator {
|
||||
protected _kR: number;
|
||||
protected _kG: number;
|
||||
protected _kB: number;
|
||||
protected _kA: number;
|
||||
calculateRaw(r1: number, g1: number, b1: number, a1: number, r2: number, g2: number, b2: number, a2: number): number;
|
||||
}
|
||||
export declare class Euclidean extends AbstractEuclidean {
|
||||
protected _setDefaults(): void;
|
||||
}
|
||||
/**
|
||||
* Euclidean color distance (RGBQuant modification w Alpha)
|
||||
*/
|
||||
export declare class EuclideanBT709 extends AbstractEuclidean {
|
||||
protected _setDefaults(): void;
|
||||
}
|
||||
/**
|
||||
* Euclidean color distance (RGBQuant modification w/o Alpha)
|
||||
*/
|
||||
export declare class EuclideanBT709NoAlpha extends AbstractEuclidean {
|
||||
protected _setDefaults(): void;
|
||||
}
|
||||
//# sourceMappingURL=euclidean.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"euclidean.d.ts","sourceRoot":"","sources":["../../../../src/distance/euclidean.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAGlE;;GAEG;AACH,8BAAsB,iBAAkB,SAAQ,0BAA0B;IACxE,UAAkB,GAAG,EAAE,MAAM,CAAC;IAC9B,UAAkB,GAAG,EAAE,MAAM,CAAC;IAC9B,UAAkB,GAAG,EAAE,MAAM,CAAC;IAC9B,UAAkB,GAAG,EAAE,MAAM,CAAC;IAE9B,YAAY,CACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM;CAab;AAED,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C,SAAS,CAAC,YAAY;CAMvB;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,SAAS,CAAC,YAAY;CAOvB;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,iBAAiB;IAC1D,SAAS,CAAC,YAAY;CAMvB"}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* iq.ts - Image Quantization Library
|
||||
*/
|
||||
export { AbstractDistanceCalculator } from './distanceCalculator';
|
||||
export { CIE94Textiles, CIE94GraphicArts } from './cie94';
|
||||
export { CIEDE2000 } from './ciede2000';
|
||||
export { CMetric } from './cmetric';
|
||||
export { AbstractEuclidean, Euclidean, EuclideanBT709NoAlpha, EuclideanBT709, } from './euclidean';
|
||||
export { AbstractManhattan, Manhattan, ManhattanBT709, ManhattanNommyde, } from './manhattan';
|
||||
export { PNGQuant } from './pngQuant';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/distance/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,qBAAqB,EACrB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* manhattanNeuQuant.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { AbstractDistanceCalculator } from './distanceCalculator';
|
||||
/**
|
||||
* Manhattan distance (NeuQuant modification) - w/o sRGB coefficients
|
||||
*/
|
||||
export declare abstract class AbstractManhattan extends AbstractDistanceCalculator {
|
||||
protected _kR: number;
|
||||
protected _kG: number;
|
||||
protected _kB: number;
|
||||
protected _kA: number;
|
||||
calculateRaw(r1: number, g1: number, b1: number, a1: number, r2: number, g2: number, b2: number, a2: number): number;
|
||||
}
|
||||
export declare class Manhattan extends AbstractManhattan {
|
||||
protected _setDefaults(): void;
|
||||
}
|
||||
/**
|
||||
* Manhattan distance (Nommyde modification)
|
||||
* https://github.com/igor-bezkrovny/image-quantization/issues/4#issuecomment-235155320
|
||||
*/
|
||||
export declare class ManhattanNommyde extends AbstractManhattan {
|
||||
protected _setDefaults(): void;
|
||||
}
|
||||
/**
|
||||
* Manhattan distance (sRGB coefficients)
|
||||
*/
|
||||
export declare class ManhattanBT709 extends AbstractManhattan {
|
||||
protected _setDefaults(): void;
|
||||
}
|
||||
//# sourceMappingURL=manhattan.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"manhattan.d.ts","sourceRoot":"","sources":["../../../../src/distance/manhattan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAGlE;;GAEG;AACH,8BAAsB,iBAAkB,SAAQ,0BAA0B;IACxE,UAAkB,GAAG,EAAE,MAAM,CAAC;IAC9B,UAAmB,GAAG,EAAE,MAAM,CAAC;IAC/B,UAAkB,GAAG,EAAE,MAAM,CAAC;IAC9B,UAAkB,GAAG,EAAE,MAAM,CAAC;IAE9B,YAAY,CACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM;CAab;AAED,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C,SAAS,CAAC,YAAY;CAMvB;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,iBAAiB;IACrD,SAAS,CAAC,YAAY;CAOvB;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,iBAAiB;IACnD,SAAS,CAAC,YAAY;CAOvB"}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* pngQuant.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { AbstractDistanceCalculator } from './distanceCalculator';
|
||||
/**
|
||||
* TODO: check quality of this distance equation
|
||||
* TODO: ask author for usage rights
|
||||
* taken from:
|
||||
* {@link http://stackoverflow.com/questions/4754506/color-similarity-distance-in-rgba-color-space/8796867#8796867}
|
||||
* {@link https://github.com/pornel/pngquant/blob/cc39b47799a7ff2ef17b529f9415ff6e6b213b8f/lib/pam.h#L148}
|
||||
*/
|
||||
export declare class PNGQuant extends AbstractDistanceCalculator {
|
||||
/**
|
||||
* Author's comments
|
||||
* px_b.rgb = px.rgb + 0*(1-px.a) // blend px on black
|
||||
* px_b.a = px.a + 1*(1-px.a)
|
||||
* px_w.rgb = px.rgb + 1*(1-px.a) // blend px on white
|
||||
* px_w.a = px.a + 1*(1-px.a)
|
||||
*
|
||||
* px_b.rgb = px.rgb // difference same as in opaque RGB
|
||||
* px_b.a = 1
|
||||
* px_w.rgb = px.rgb - px.a // difference simplifies to formula below
|
||||
* px_w.a = 1
|
||||
*
|
||||
* (px.rgb - px.a) - (py.rgb - py.a)
|
||||
* (px.rgb - py.rgb) + (py.a - px.a)
|
||||
*
|
||||
*/
|
||||
calculateRaw(r1: number, g1: number, b1: number, a1: number, r2: number, g2: number, b2: number, a2: number): number;
|
||||
private _colordifferenceCh;
|
||||
protected _setDefaults(): void;
|
||||
}
|
||||
//# sourceMappingURL=pngQuant.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pngQuant.d.ts","sourceRoot":"","sources":["../../../../src/distance/pngQuant.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE;;;;;;GAMG;AACH,qBAAa,QAAS,SAAQ,0BAA0B;IACtD;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM;IAsBZ,OAAO,CAAC,kBAAkB;IAS1B,SAAS,CAAC,YAAY;CACvB"}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* ditherErrorDiffusionArray.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { AbstractImageQuantizer } from './imageQuantizer';
|
||||
import { AbstractDistanceCalculator } from '../distance/distanceCalculator';
|
||||
import { PointContainer } from '../utils/pointContainer';
|
||||
import { Palette } from '../utils/palette';
|
||||
import { ImageQuantizerYieldValue } from './imageQuantizerYieldValue';
|
||||
export declare enum ErrorDiffusionArrayKernel {
|
||||
FloydSteinberg = 0,
|
||||
FalseFloydSteinberg = 1,
|
||||
Stucki = 2,
|
||||
Atkinson = 3,
|
||||
Jarvis = 4,
|
||||
Burkes = 5,
|
||||
Sierra = 6,
|
||||
TwoSierra = 7,
|
||||
SierraLite = 8
|
||||
}
|
||||
export declare class ErrorDiffusionArray extends AbstractImageQuantizer {
|
||||
private _minColorDistance;
|
||||
private _serpentine;
|
||||
private _kernel;
|
||||
/** true = GIMP, false = XNVIEW */
|
||||
private _calculateErrorLikeGIMP;
|
||||
private _distance;
|
||||
constructor(colorDistanceCalculator: AbstractDistanceCalculator, kernel: ErrorDiffusionArrayKernel, serpentine?: boolean, minimumColorDistanceToDither?: number, calculateErrorLikeGIMP?: boolean);
|
||||
/**
|
||||
* adapted from http://jsbin.com/iXofIji/2/edit by PAEz
|
||||
* fixed version. it doesn't use image pixels as error storage, also it doesn't have 0.3 + 0.3 + 0.3 + 0.3 = 0 error
|
||||
* Mutates pointContainer
|
||||
*/
|
||||
quantize(pointContainer: PointContainer, palette: Palette): IterableIterator<ImageQuantizerYieldValue>;
|
||||
private _fillErrorLine;
|
||||
private _setKernel;
|
||||
}
|
||||
//# sourceMappingURL=array.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../../src/image/array.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAItE,oBAAY,yBAAyB;IACnC,cAAc,IAAI;IAClB,mBAAmB,IAAA;IACnB,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,MAAM,IAAA;IACN,MAAM,IAAA;IACN,MAAM,IAAA;IACN,SAAS,IAAA;IACT,UAAU,IAAA;CACX;AAGD,qBAAa,mBAAoB,SAAQ,sBAAsB;IAC7D,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,OAAO,CAAc;IAC7B,kCAAkC;IAClC,OAAO,CAAC,uBAAuB,CAAU;IAEzC,OAAO,CAAC,SAAS,CAA6B;gBAG5C,uBAAuB,EAAE,0BAA0B,EACnD,MAAM,EAAE,yBAAyB,EACjC,UAAU,UAAO,EACjB,4BAA4B,SAAI,EAChC,sBAAsB,UAAQ;IAWhC;;;;OAIG;IACF,QAAQ,CACP,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,GACf,gBAAgB,CAAC,wBAAwB,CAAC;IAsH7C,OAAO,CAAC,cAAc;IAmBtB,OAAO,CAAC,UAAU;CAoHnB"}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* common.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { PointContainer } from '../utils/pointContainer';
|
||||
import { Palette } from '../utils/palette';
|
||||
import { ImageQuantizerYieldValue } from './imageQuantizerYieldValue';
|
||||
export declare abstract class AbstractImageQuantizer {
|
||||
abstract quantize(pointContainer: PointContainer, palette: Palette): IterableIterator<ImageQuantizerYieldValue>;
|
||||
quantizeSync(pointContainer: PointContainer, palette: Palette): PointContainer;
|
||||
}
|
||||
//# sourceMappingURL=imageQuantizer.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"imageQuantizer.d.ts","sourceRoot":"","sources":["../../../../src/image/imageQuantizer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,8BAAsB,sBAAsB;IAC1C,QAAQ,CAAC,QAAQ,CACf,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,GACf,gBAAgB,CAAC,wBAAwB,CAAC;IAE7C,YAAY,CAAC,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO;CAS9D"}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import { PointContainer } from '../utils';
|
||||
export interface ImageQuantizerYieldValue {
|
||||
progress: number;
|
||||
pointContainer?: PointContainer;
|
||||
}
|
||||
//# sourceMappingURL=imageQuantizerYieldValue.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"imageQuantizerYieldValue.d.ts","sourceRoot":"","sources":["../../../../src/image/imageQuantizerYieldValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC"}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* iq.ts - Image Quantization Library
|
||||
*/
|
||||
export { AbstractImageQuantizer } from './imageQuantizer';
|
||||
export { ImageQuantizerYieldValue } from './imageQuantizerYieldValue';
|
||||
export { NearestColor } from './nearestColor';
|
||||
export { ErrorDiffusionArray, ErrorDiffusionArrayKernel } from './array';
|
||||
export { ErrorDiffusionRiemersma } from './riemersma';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/image/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC"}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* nearestColor.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { AbstractImageQuantizer } from './imageQuantizer';
|
||||
import { AbstractDistanceCalculator } from '../distance/distanceCalculator';
|
||||
import { PointContainer } from '../utils/pointContainer';
|
||||
import { Palette } from '../utils/palette';
|
||||
import { ImageQuantizerYieldValue } from './imageQuantizerYieldValue';
|
||||
export declare class NearestColor extends AbstractImageQuantizer {
|
||||
private _distance;
|
||||
constructor(colorDistanceCalculator: AbstractDistanceCalculator);
|
||||
/**
|
||||
* Mutates pointContainer
|
||||
*/
|
||||
quantize(pointContainer: PointContainer, palette: Palette): IterableIterator<ImageQuantizerYieldValue>;
|
||||
}
|
||||
//# sourceMappingURL=nearestColor.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"nearestColor.d.ts","sourceRoot":"","sources":["../../../../src/image/nearestColor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,qBAAa,YAAa,SAAQ,sBAAsB;IACtD,OAAO,CAAC,SAAS,CAA6B;gBAElC,uBAAuB,EAAE,0BAA0B;IAK/D;;OAEG;IACF,QAAQ,CACP,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,GACf,gBAAgB,CAAC,wBAAwB,CAAC;CAyB9C"}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @preserve
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*
|
||||
* riemersma.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { AbstractImageQuantizer } from './imageQuantizer';
|
||||
import { AbstractDistanceCalculator } from '../distance/distanceCalculator';
|
||||
import { PointContainer } from '../utils/pointContainer';
|
||||
import { Palette } from '../utils/palette';
|
||||
export declare class ErrorDiffusionRiemersma extends AbstractImageQuantizer {
|
||||
private _distance;
|
||||
private _weights;
|
||||
private _errorQueueSize;
|
||||
constructor(colorDistanceCalculator: AbstractDistanceCalculator, errorQueueSize?: number, errorPropagation?: number);
|
||||
/**
|
||||
* Mutates pointContainer
|
||||
*/
|
||||
quantize(pointContainer: PointContainer, palette: Palette): Generator<import("./imageQuantizerYieldValue").ImageQuantizerYieldValue, void, undefined>;
|
||||
private static _createWeights;
|
||||
}
|
||||
//# sourceMappingURL=riemersma.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"riemersma.d.ts","sourceRoot":"","sources":["../../../../src/image/riemersma.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,qBAAa,uBAAwB,SAAQ,sBAAsB;IACjE,OAAO,CAAC,SAAS,CAA6B;IAC9C,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,eAAe,CAAS;gBAG9B,uBAAuB,EAAE,0BAA0B,EACnD,cAAc,SAAK,EACnB,gBAAgB,SAAI;IAWtB;;OAEG;IACF,QAAQ,CAAC,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO;IA8D1D,OAAO,CAAC,MAAM,CAAC,cAAc;CAgB9B"}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import { ImageQuantizerYieldValue } from '../imageQuantizerYieldValue';
|
||||
export declare function hilbertCurve(width: number, height: number, callback: (x: number, y: number) => void): Generator<ImageQuantizerYieldValue, void, undefined>;
|
||||
//# sourceMappingURL=hilbertCurve.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"hilbertCurve.d.ts","sourceRoot":"","sources":["../../../../../src/image/spaceFillingCurves/hilbertCurve.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAqBvE,wBAAiB,YAAY,CAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,wDAiBzC"}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* iq.ts - Image Quantization Library
|
||||
*/
|
||||
import * as constants from './constants';
|
||||
import * as conversion from './conversion';
|
||||
import * as distance from './distance';
|
||||
import * as palette from './palette';
|
||||
import * as image from './image';
|
||||
import * as quality from './quality';
|
||||
import * as utils from './utils';
|
||||
export { buildPalette, buildPaletteSync, applyPalette, applyPaletteSync, } from './basicAPI';
|
||||
export type { ImageQuantization, PaletteQuantization, ColorDistanceFormula, } from './basicAPI';
|
||||
export { constants, conversion, distance, palette, image, quality, utils };
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* iq.ts - Image Quantization Library
|
||||
*/
|
||||
export { AbstractPaletteQuantizer } from './paletteQuantizer';
|
||||
export { NeuQuant } from './neuquant/neuquant';
|
||||
export { NeuQuantFloat } from './neuquant/neuquantFloat';
|
||||
export { RGBQuant } from './rgbquant/rgbquant';
|
||||
export { ColorHistogram } from './rgbquant/colorHistogram';
|
||||
export { WuQuant, WuColorCube } from './wu/wuQuant';
|
||||
export { PaletteQuantizerYieldValue } from './paletteQuantizerYieldValue';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/palette/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC"}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
import { PointContainer } from '../../utils/pointContainer';
|
||||
import { AbstractDistanceCalculator } from '../../distance/distanceCalculator';
|
||||
import { AbstractPaletteQuantizer } from '../paletteQuantizer';
|
||||
import { PaletteQuantizerYieldValue } from '../paletteQuantizerYieldValue';
|
||||
export declare class NeuQuant extends AbstractPaletteQuantizer {
|
||||
private static readonly _prime1;
|
||||
private static readonly _prime2;
|
||||
private static readonly _prime3;
|
||||
private static readonly _prime4;
|
||||
private static readonly _minpicturebytes;
|
||||
private static readonly _nCycles;
|
||||
private static readonly _initialBiasShift;
|
||||
private static readonly _initialBias;
|
||||
private static readonly _gammaShift;
|
||||
private static readonly _betaShift;
|
||||
private static readonly _beta;
|
||||
private static readonly _betaGamma;
|
||||
private static readonly _radiusBiasShift;
|
||||
private static readonly _radiusBias;
|
||||
private static readonly _radiusDecrease;
|
||||
private static readonly _alphaBiasShift;
|
||||
private static readonly _initAlpha;
|
||||
private static readonly _radBiasShift;
|
||||
private static readonly _radBias;
|
||||
private static readonly _alphaRadBiasShift;
|
||||
private static readonly _alphaRadBias;
|
||||
private _pointArray;
|
||||
private readonly _networkSize;
|
||||
private _network;
|
||||
/** sampling factor 1..30 */
|
||||
private readonly _sampleFactor;
|
||||
private _radPower;
|
||||
private _freq;
|
||||
private _bias;
|
||||
private readonly _distance;
|
||||
constructor(colorDistanceCalculator: AbstractDistanceCalculator, colors?: number);
|
||||
sample(pointContainer: PointContainer): void;
|
||||
quantize(): IterableIterator<PaletteQuantizerYieldValue>;
|
||||
private _init;
|
||||
/**
|
||||
* Main Learning Loop
|
||||
*/
|
||||
private _learn;
|
||||
private _buildPalette;
|
||||
/**
|
||||
* Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in radpower[|i-j|]
|
||||
*/
|
||||
private _alterNeighbour;
|
||||
/**
|
||||
* Move neuron i towards biased (b,g,r) by factor alpha
|
||||
*/
|
||||
private _alterSingle;
|
||||
/**
|
||||
* Search for biased BGR values
|
||||
* description:
|
||||
* finds closest neuron (min dist) and updates freq
|
||||
* finds best neuron (min dist-bias) and returns position
|
||||
* for frequently chosen neurons, freq[i] is high and bias[i] is negative
|
||||
* bias[i] = _gamma*((1/this._networkSize)-freq[i])
|
||||
*
|
||||
* Original distance equation:
|
||||
* dist = abs(dR) + abs(dG) + abs(dB)
|
||||
*/
|
||||
private _contest;
|
||||
}
|
||||
//# sourceMappingURL=neuquant.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"neuquant.d.ts","sourceRoot":"","sources":["../../../../../src/palette/neuquant/neuquant.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,C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,CACU;IACpD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAoC;IAEzE,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAY;IAE5B,4BAA4B;IAC5B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;IACxC,OAAO,CAAC,SAAS,CAAY;IAG7B,OAAO,CAAC,KAAK,CAAY;IAGzB,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA6B;gBAGrD,uBAAuB,EAAE,0BAA0B,EACnD,MAAM,SAAM;IAgBd,MAAM,CAAC,cAAc,EAAE,cAAc;IAIpC,QAAQ,IAAI,gBAAgB,CAAC,0BAA0B,CAAC;IAWzD,OAAO,CAAC,KAAK;IAgBb;;OAEG;IACH,OAAO,CAAE,MAAM;IA2Ef,OAAO,CAAC,aAAa;IAWrB;;OAEG;IACH,OAAO,CAAC,eAAe;IAgCvB;;OAEG;IACH,OAAO,CAAC,YAAY;IAoBpB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,QAAQ;CAkCjB"}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
import { PointContainer } from '../../utils/pointContainer';
|
||||
import { AbstractDistanceCalculator } from '../../distance/distanceCalculator';
|
||||
import { AbstractPaletteQuantizer } from '../paletteQuantizer';
|
||||
import { PaletteQuantizerYieldValue } from '../paletteQuantizerYieldValue';
|
||||
export declare class NeuQuantFloat extends AbstractPaletteQuantizer {
|
||||
private static readonly _prime1;
|
||||
private static readonly _prime2;
|
||||
private static readonly _prime3;
|
||||
private static readonly _prime4;
|
||||
private static readonly _minpicturebytes;
|
||||
private static readonly _nCycles;
|
||||
private static readonly _initialBiasShift;
|
||||
private static readonly _initialBias;
|
||||
private static readonly _gammaShift;
|
||||
private static readonly _betaShift;
|
||||
private static readonly _beta;
|
||||
private static readonly _betaGamma;
|
||||
private static readonly _radiusBiasShift;
|
||||
private static readonly _radiusBias;
|
||||
private static readonly _radiusDecrease;
|
||||
private static readonly _alphaBiasShift;
|
||||
private static readonly _initAlpha;
|
||||
private static readonly _radBiasShift;
|
||||
private static readonly _radBias;
|
||||
private static readonly _alphaRadBiasShift;
|
||||
private static readonly _alphaRadBias;
|
||||
private _pointArray;
|
||||
private readonly _networkSize;
|
||||
private _network;
|
||||
/** sampling factor 1..30 */
|
||||
private readonly _sampleFactor;
|
||||
private _radPower;
|
||||
private _freq;
|
||||
private _bias;
|
||||
private readonly _distance;
|
||||
constructor(colorDistanceCalculator: AbstractDistanceCalculator, colors?: number);
|
||||
sample(pointContainer: PointContainer): void;
|
||||
quantize(): Generator<PaletteQuantizerYieldValue, void, undefined>;
|
||||
private _init;
|
||||
/**
|
||||
* Main Learning Loop
|
||||
*/
|
||||
private _learn;
|
||||
private _buildPalette;
|
||||
/**
|
||||
* Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in radpower[|i-j|]
|
||||
*/
|
||||
private _alterNeighbour;
|
||||
/**
|
||||
* Move neuron i towards biased (b,g,r) by factor alpha
|
||||
*/
|
||||
private _alterSingle;
|
||||
/**
|
||||
* Search for biased BGR values
|
||||
* description:
|
||||
* finds closest neuron (min dist) and updates freq
|
||||
* finds best neuron (min dist-bias) and returns position
|
||||
* for frequently chosen neurons, freq[i] is high and bias[i] is negative
|
||||
* bias[i] = _gamma*((1/this._networkSize)-freq[i])
|
||||
*
|
||||
* Original distance equation:
|
||||
* dist = abs(dR) + abs(dG) + abs(dB)
|
||||
*/
|
||||
private _contest;
|
||||
}
|
||||
//# sourceMappingURL=neuquantFloat.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"neuquantFloat.d.ts","sourceRoot":"","sources":["../../../../../src/palette/neuquant/neuquantFloat.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE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,CAAC,QAAQ,CAAoC;IACpE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CACoB;IAC9D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAyC;IAE9E,OAAO,CAAC,WAAW,CAAW;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAU;IACvC,OAAO,CAAC,QAAQ,CAAiB;IAEjC,4BAA4B;IAC5B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;IACxC,OAAO,CAAC,SAAS,CAAY;IAG7B,OAAO,CAAC,KAAK,CAAY;IAGzB,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA6B;gBAGrD,uBAAuB,EAAE,0BAA0B,EACnD,MAAM,SAAM;IAgBd,MAAM,CAAC,cAAc,EAAE,cAAc;IAIpC,QAAQ;IAUT,OAAO,CAAC,KAAK;IAgBb;;OAEG;IACH,OAAO,CAAE,MAAM;IA0Ef,OAAO,CAAC,aAAa;IAWrB;;OAEG;IACH,OAAO,CAAC,eAAe;IAgCvB;;OAEG;IACH,OAAO,CAAC,YAAY;IAoBpB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,QAAQ;CAiCjB"}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* common.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { PointContainer } from '../utils/pointContainer';
|
||||
import { PaletteQuantizerYieldValue } from './paletteQuantizerYieldValue';
|
||||
export declare abstract class AbstractPaletteQuantizer {
|
||||
abstract sample(pointContainer: PointContainer): void;
|
||||
abstract quantize(): IterableIterator<PaletteQuantizerYieldValue>;
|
||||
quantizeSync(): import("../utils").Palette;
|
||||
}
|
||||
//# sourceMappingURL=paletteQuantizer.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"paletteQuantizer.d.ts","sourceRoot":"","sources":["../../../../src/palette/paletteQuantizer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,8BAAsB,wBAAwB;IAC5C,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI;IACrD,QAAQ,CAAC,QAAQ,IAAI,gBAAgB,CAAC,0BAA0B,CAAC;IAEjE,YAAY;CASb"}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import { Palette } from '../utils';
|
||||
export interface PaletteQuantizerYieldValue {
|
||||
progress: number;
|
||||
palette?: Palette;
|
||||
}
|
||||
//# sourceMappingURL=paletteQuantizerYieldValue.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"paletteQuantizerYieldValue.d.ts","sourceRoot":"","sources":["../../../../src/palette/paletteQuantizerYieldValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
import { PointContainer } from '../../utils/pointContainer';
|
||||
export declare class ColorHistogram {
|
||||
private static _boxSize;
|
||||
private static _boxPixels;
|
||||
private static _hueGroups;
|
||||
private _method;
|
||||
private _hueStats;
|
||||
private _histogram;
|
||||
private _initColors;
|
||||
private _minHueCols;
|
||||
constructor(method: number, colors: number);
|
||||
sample(pointContainer: PointContainer): void;
|
||||
getImportanceSortedColorsIDXI32(): number[];
|
||||
private _colorStats1D;
|
||||
private _colorStats2D;
|
||||
private _iterateBox;
|
||||
/**
|
||||
* partitions a rectangle of width x height into
|
||||
* array of boxes stepX x stepY (or less)
|
||||
*/
|
||||
private _makeBoxes;
|
||||
}
|
||||
//# sourceMappingURL=colorHistogram.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"colorHistogram.d.ts","sourceRoot":"","sources":["../../../../../src/palette/rgbquant/colorHistogram.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAU5D,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAY;IACnC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAK;IAC9B,OAAO,CAAC,MAAM,CAAC,UAAU,CAAM;IAG/B,OAAO,CAAC,OAAO,CAAS;IAGxB,OAAO,CAAC,SAAS,CAAgB;IAEjC,OAAO,CAAC,UAAU,CAA8B;IAGhD,OAAO,CAAC,WAAW,CAAS;IAG5B,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAmB1C,MAAM,CAAC,cAAc,EAAE,cAAc;IAWrC,+BAA+B;IA4C/B,OAAO,CAAC,aAAa;IAsBrB,OAAO,CAAC,aAAa;IAuCrB,OAAO,CAAC,WAAW;IAenB;;;OAGG;IACH,OAAO,CAAC,UAAU;CAyBnB"}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import { PointContainer } from '../../utils/pointContainer';
|
||||
import { AbstractDistanceCalculator } from '../../distance/distanceCalculator';
|
||||
import { AbstractPaletteQuantizer } from '../paletteQuantizer';
|
||||
import { PaletteQuantizerYieldValue } from '../paletteQuantizerYieldValue';
|
||||
export declare class RGBQuant extends AbstractPaletteQuantizer {
|
||||
private readonly _colors;
|
||||
private readonly _initialDistance;
|
||||
private readonly _distanceIncrement;
|
||||
private readonly _histogram;
|
||||
private readonly _distance;
|
||||
constructor(colorDistanceCalculator: AbstractDistanceCalculator, colors?: number, method?: number);
|
||||
sample(image: PointContainer): void;
|
||||
quantize(): Generator<PaletteQuantizerYieldValue, void, undefined>;
|
||||
private _buildPalette;
|
||||
}
|
||||
//# sourceMappingURL=rgbquant.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"rgbquant.d.ts","sourceRoot":"","sources":["../../../../../src/palette/rgbquant/rgbquant.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAiB3E,qBAAa,QAAS,SAAQ,wBAAwB;IAEpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAGjC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAG1C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAG5C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiB;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA6B;gBAGrD,uBAAuB,EAAE,0BAA0B,EACnD,MAAM,SAAM,EACZ,MAAM,SAAI;IAeZ,MAAM,CAAC,KAAK,EAAE,cAAc;IAqB3B,QAAQ;IAUT,OAAO,CAAE,aAAa;CA8FvB"}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
import { PointContainer } from '../../utils/pointContainer';
|
||||
import { AbstractDistanceCalculator } from '../../distance/distanceCalculator';
|
||||
import { AbstractPaletteQuantizer } from '../paletteQuantizer';
|
||||
import { PaletteQuantizerYieldValue } from '../paletteQuantizerYieldValue';
|
||||
export declare class WuColorCube {
|
||||
redMinimum: number;
|
||||
redMaximum: number;
|
||||
greenMinimum: number;
|
||||
greenMaximum: number;
|
||||
blueMinimum: number;
|
||||
blueMaximum: number;
|
||||
volume: number;
|
||||
alphaMinimum: number;
|
||||
alphaMaximum: number;
|
||||
}
|
||||
export declare class WuQuant extends AbstractPaletteQuantizer {
|
||||
private static readonly _alpha;
|
||||
private static readonly _red;
|
||||
private static readonly _green;
|
||||
private static readonly _blue;
|
||||
private _reds;
|
||||
private _greens;
|
||||
private _blues;
|
||||
private _alphas;
|
||||
private _sums;
|
||||
private _weights;
|
||||
private _momentsRed;
|
||||
private _momentsGreen;
|
||||
private _momentsBlue;
|
||||
private _momentsAlpha;
|
||||
private _moments;
|
||||
private _table;
|
||||
private _pixels;
|
||||
private _cubes;
|
||||
private _colors;
|
||||
private _significantBitsPerChannel;
|
||||
private _maxSideIndex;
|
||||
private _alphaMaxSideIndex;
|
||||
private _sideSize;
|
||||
private _alphaSideSize;
|
||||
private readonly _distance;
|
||||
constructor(colorDistanceCalculator: AbstractDistanceCalculator, colors?: number, significantBitsPerChannel?: number);
|
||||
sample(image: PointContainer): void;
|
||||
quantize(): Generator<PaletteQuantizerYieldValue, void, undefined>;
|
||||
private _preparePalette;
|
||||
private _addColor;
|
||||
/**
|
||||
* Converts the histogram to a series of _moments.
|
||||
*/
|
||||
private _calculateMoments;
|
||||
/**
|
||||
* Computes the volume of the cube in a specific moment.
|
||||
*/
|
||||
private static _volumeFloat;
|
||||
/**
|
||||
* Computes the volume of the cube in a specific moment.
|
||||
*/
|
||||
private static _volume;
|
||||
/**
|
||||
* Splits the cube in given position][and color direction.
|
||||
*/
|
||||
private static _top;
|
||||
/**
|
||||
* Splits the cube in a given color direction at its minimum.
|
||||
*/
|
||||
private static _bottom;
|
||||
/**
|
||||
* Calculates statistical variance for a given cube.
|
||||
*/
|
||||
private _calculateVariance;
|
||||
/**
|
||||
* Finds the optimal (maximal) position for the cut.
|
||||
*/
|
||||
private _maximize;
|
||||
private _cut;
|
||||
private _initialize;
|
||||
private _setQuality;
|
||||
}
|
||||
//# sourceMappingURL=wuQuant.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"wuQuant.d.ts","sourceRoot":"","sources":["../../../../../src/palette/wu/wuQuant.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAA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CAAU;IAC5C,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,kBAAkB,CAAU;IACpC,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,cAAc,CAAU;IAEhC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA6B;gBAGrD,uBAAuB,EAAE,0BAA0B,EACnD,MAAM,SAAM,EACZ,yBAAyB,SAAI;IAQ/B,MAAM,CAAC,KAAK,EAAE,cAAc;IAU3B,QAAQ;IA2BT,OAAO,CAAE,eAAe;IAiHxB,OAAO,CAAC,SAAS;IAqBjB;;OAEG;IACH,OAAO,CAAE,iBAAiB;IA2L1B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAqD3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,OAAO;IAItB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,IAAI;IA8HnB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,OAAO;IA4HtB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAgB1B;;OAEG;IACH,OAAO,CAAC,SAAS;IAwEjB,OAAO,CAAC,IAAI;IAmIZ,OAAO,CAAC,WAAW;IAoEnB,OAAO,CAAC,WAAW;CAQpB"}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* iq.ts - Image Quantization Library
|
||||
*/
|
||||
export { ssim } from './ssim';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/quality/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* ssim.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { PointContainer } from '../utils/pointContainer';
|
||||
export declare function ssim(image1: PointContainer, image2: PointContainer): number;
|
||||
//# sourceMappingURL=ssim.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ssim.d.ts","sourceRoot":"","sources":["../../../../src/quality/ssim.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAQzD,wBAAgB,IAAI,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,UAqDlE"}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
export declare function degrees2radians(n: number): number;
|
||||
export declare function max3(a: number, b: number, c: number): number;
|
||||
export declare function min3(a: number, b: number, c: number): number;
|
||||
export declare function intInRange(value: number, low: number, high: number): number;
|
||||
export declare function inRange0to255Rounded(n: number): number;
|
||||
export declare function inRange0to255(n: number): number;
|
||||
export declare function stableSort<T>(arrayToSort: T[], callback: (a: T, b: T) => number): T[];
|
||||
//# sourceMappingURL=arithmetic.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"arithmetic.d.ts","sourceRoot":"","sources":["../../../../src/utils/arithmetic.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,UAExC;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAKnD;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAKnD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAIlE;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,UAK7C;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,UAItC;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,WAAW,EAAE,CAAC,EAAE,EAChB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,OAsBjC"}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
export declare class HueStatistics {
|
||||
private _numGroups;
|
||||
private _minCols;
|
||||
private _stats;
|
||||
private _groupsFull;
|
||||
constructor(numGroups: number, minCols: number);
|
||||
check(i32: number): void;
|
||||
injectIntoDictionary(histG: Record<string, number>): void;
|
||||
injectIntoArray(histG: string[]): void;
|
||||
}
|
||||
//# sourceMappingURL=hueStatistics.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"hueStatistics.d.ts","sourceRoot":"","sources":["../../../../src/utils/hueStatistics.ts"],"names":[],"mappings":"AAeA,qBAAa,aAAa;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,WAAW,CAAS;gBAEhB,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAY9C,KAAK,CAAC,GAAG,EAAE,MAAM;IA6BjB,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAclD,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE;CAWhC"}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* iq.ts - Image Quantization Library
|
||||
*/
|
||||
import * as arithmetic from './arithmetic';
|
||||
import { HueStatistics } from './hueStatistics';
|
||||
import { Palette } from './palette';
|
||||
import { Point } from './point';
|
||||
import { PointContainer } from './pointContainer';
|
||||
import { ProgressTracker } from './progressTracker';
|
||||
export { Point, PointContainer, Palette, HueStatistics, ProgressTracker, arithmetic, };
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACL,KAAK,EACL,cAAc,EACd,OAAO,EACP,aAAa,EACb,eAAe,EACf,UAAU,GACX,CAAC"}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* palette.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { Point } from './point';
|
||||
import { PointContainer } from './pointContainer';
|
||||
import { AbstractDistanceCalculator } from '../distance/distanceCalculator';
|
||||
export declare function hueGroup(hue: number, segmentsNumber: number): number;
|
||||
export declare class Palette {
|
||||
private readonly _pointContainer;
|
||||
private readonly _pointArray;
|
||||
private _i32idx;
|
||||
constructor();
|
||||
add(color: Point): void;
|
||||
has(color: Point): boolean;
|
||||
getNearestColor(colorDistanceCalculator: AbstractDistanceCalculator, color: Point): Point;
|
||||
getPointContainer(): PointContainer;
|
||||
private _nearestPointFromCache;
|
||||
private _getNearestIndex;
|
||||
sort(): void;
|
||||
}
|
||||
//# sourceMappingURL=palette.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../../../src/utils/palette.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAO5E,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,UAS3D;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,OAAO,CAAiC;;IAQhD,GAAG,CAAC,KAAK,EAAE,KAAK;IAKhB,GAAG,CAAC,KAAK,EAAE,KAAK;IAShB,eAAe,CACb,uBAAuB,EAAE,0BAA0B,EACnD,KAAK,EAAE,KAAK;IAOd,iBAAiB;IAkCjB,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,gBAAgB;IAoFxB,IAAI;CAkCL"}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
export interface PointRGBA {
|
||||
r: number;
|
||||
g: number;
|
||||
b: number;
|
||||
a: number;
|
||||
}
|
||||
/**
|
||||
* v8 optimized class
|
||||
* 1) "constructor" should have initialization with worst types
|
||||
* 2) "set" should have |0 / >>> 0
|
||||
*/
|
||||
export declare class Point implements PointRGBA {
|
||||
r: number;
|
||||
g: number;
|
||||
b: number;
|
||||
a: number;
|
||||
uint32: number;
|
||||
rgba: number[];
|
||||
static createByQuadruplet(quadruplet: number[]): Point;
|
||||
static createByRGBA(red: number, green: number, blue: number, alpha: number): Point;
|
||||
static createByUint32(uint32: number): Point;
|
||||
constructor();
|
||||
from(point: Point): void;
|
||||
getLuminosity(useAlphaChannel: boolean): number;
|
||||
private _loadUINT32;
|
||||
private _loadRGBA;
|
||||
private _loadQuadruplet;
|
||||
}
|
||||
//# sourceMappingURL=point.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../src/utils/point.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;GAIG;AACH,qBAAa,KAAM,YAAW,SAAS;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IAGf,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE;IAa9C,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAa3E,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM;;IA2BpC,IAAI,CAAC,KAAK,EAAE,KAAK;IA0BjB,aAAa,CAAC,eAAe,EAAE,OAAO;IAsBtC,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,eAAe;CAuBxB"}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/// <reference types="node" />
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* pointContainer.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { Point } from './point';
|
||||
/**
|
||||
* v8 optimizations done.
|
||||
* fromXXX methods are static to move out polymorphic code from class instance itself.
|
||||
*/
|
||||
export declare class PointContainer {
|
||||
private readonly _pointArray;
|
||||
private _width;
|
||||
private _height;
|
||||
constructor();
|
||||
getWidth(): number;
|
||||
getHeight(): number;
|
||||
setWidth(width: number): void;
|
||||
setHeight(height: number): void;
|
||||
getPointArray(): Point[];
|
||||
clone(): PointContainer;
|
||||
toUint32Array(): Uint32Array;
|
||||
toUint8Array(): Uint8Array;
|
||||
static fromHTMLImageElement(img: HTMLImageElement): PointContainer;
|
||||
static fromHTMLCanvasElement(canvas: HTMLCanvasElement): PointContainer;
|
||||
static fromImageData(imageData: ImageData): PointContainer;
|
||||
static fromUint8Array(uint8Array: number[] | Uint8Array | Uint8ClampedArray, width: number, height: number): PointContainer;
|
||||
static fromUint32Array(uint32Array: Uint32Array, width: number, height: number): PointContainer;
|
||||
static fromBuffer(buffer: Buffer, width: number, height: number): PointContainer;
|
||||
}
|
||||
//# sourceMappingURL=pointContainer.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pointContainer.d.ts","sourceRoot":"","sources":["../../../../src/utils/pointContainer.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAU;IACtC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;;IAQxB,QAAQ;IAIR,SAAS;IAIT,QAAQ,CAAC,KAAK,EAAE,MAAM;IAItB,SAAS,CAAC,MAAM,EAAE,MAAM;IAIxB,aAAa;IAIb,KAAK;IAcL,aAAa;IAWb,YAAY;IAIZ,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,gBAAgB;IAcjD,MAAM,CAAC,qBAAqB,CAAC,MAAM,EAAE,iBAAiB;IAUtD,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS;IAOzC,MAAM,CAAC,cAAc,CACnB,UAAU,EAAE,MAAM,EAAE,GAAG,UAAU,GAAG,iBAAiB,EACrD,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;IAehB,MAAM,CAAC,eAAe,CACpB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;IAchB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAQhE"}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
export declare class ProgressTracker {
|
||||
static readonly steps = 100;
|
||||
progress: number;
|
||||
private _step;
|
||||
private _range;
|
||||
private _last;
|
||||
private _progressRange;
|
||||
constructor(valueRange: number, progressRange: number);
|
||||
shouldNotify(current: number): boolean;
|
||||
}
|
||||
//# sourceMappingURL=progressTracker.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"progressTracker.d.ts","sourceRoot":"","sources":["../../../../src/utils/progressTracker.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAe;IAC1B,MAAM,CAAC,QAAQ,CAAC,KAAK,OAAO;IAE5B,QAAQ,EAAE,MAAM,CAAC;IAEjB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,cAAc,CAAS;gBAEnB,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IAQrD,YAAY,CAAC,OAAO,EAAE,MAAM;CAY7B"}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"name": "image-q",
|
||||
"version": "4.0.0",
|
||||
"description": "Image Quantization Library in **TypeScript** *(MIT Licensed)*",
|
||||
"license": "MIT",
|
||||
"contributors": [],
|
||||
"homepage": "https://github.com/ibezkrovnyi/image-quantization/tree/main/packages/image-q",
|
||||
"main": "./dist/cjs/image-q.cjs",
|
||||
"module": "./dist/esm/image-q.mjs",
|
||||
"types": "./dist/types/src/index.d.ts",
|
||||
"exports": {
|
||||
"types": "./dist/types/src/index.d.ts",
|
||||
"import": "./dist/esm/image-q.mjs",
|
||||
"require": "./dist/cjs/image-q.cjs",
|
||||
"default": "./dist/esm/image-q.mjs"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"preferGlobal": false,
|
||||
"keywords": [
|
||||
"image",
|
||||
"palette",
|
||||
"quantization",
|
||||
"quantizer",
|
||||
"color",
|
||||
"neuquant",
|
||||
"rgbquant",
|
||||
"xiaolin wu",
|
||||
"cie94 distance",
|
||||
"ciede2000",
|
||||
"dithering",
|
||||
"floyd-steinberg"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ibezkrovnyi/image-quantization"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ibezkrovnyi/image-quantization/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/pngjs": "3.3.0",
|
||||
"gh-pages": "3.2.3",
|
||||
"pngjs": "3.3.3",
|
||||
"typedoc": "0.22.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "16.9.1"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "shx rm -rf ./node_modules/.cache",
|
||||
"build": "pnpm compile:types && pnpm compile:esm && pnpm compile:cjs && shx cp ../../README.md ./",
|
||||
"test": "jest",
|
||||
"gh-pages": "shx rm -rf ./docs && typedoc && gh-pages -d docs",
|
||||
"compile:types": "tsc -p tsconfig.compile.json",
|
||||
"compile:esm": "esbuild src/index.ts --outfile=dist/esm/image-q.mjs --tsconfig=tsconfig.compile.json --format=esm --platform=neutral --sourcemap --target=es2020,chrome58,node12 --bundle",
|
||||
"compile:cjs": "esbuild src/index.ts --outfile=dist/cjs/image-q.cjs --tsconfig=tsconfig.compile.json --format=cjs --platform=node --sourcemap --target=es2020,chrome58,node12 --bundle"
|
||||
},
|
||||
"readme": "## image-q\n\nComplete Image Quantization Library in **TypeScript** _(MIT License)_\n\n[](https://ibezkrovnyi.github.io/image-quantization-demo/)\n[](https://github.com/ibezkrovnyi/image-quantization/tree/main/packages/image-q)\n[](https://www.npmjs.com/package/image-q)\n[](http://ibezkrovnyi.github.io/image-quantization/)\n[](LICENSE)\n\n\n\n## Table of Contents\n\n- [<span style=\"color: red\">API Documentation and Usage</span>](http://ibezkrovnyi.github.io/image-quantization/)\n- [Introduction](#introduction)\n- [Features](#features)\n- [Todo](#todo)\n- [Breaking changes](#breaking-changes)\n- [Changelog](#changelog)\n- [Credits](#credits)\n- [References](#references)\n- [License](#license)\n\n## Introduction\n\nImage Color Number Reduction with alpha support using RGBQuant/NeuQuant/Xiaolin Wu's algorithms and Euclidean/Manhattan/CIEDE2000 color distance formulas in TypeScript\n\n## Features\n\n1. Platforms supported\n\n - Browser (Chrome 7.0+, FireFox 4.0+, IE 10+, Opera 11.6+, Safari 5.1+)\n - Node.js 6.0+\n\n2. API\n - Basic API: sync and promise-based async\n - Advanced API: sync and generator-based\n3. Builds\n\n - `dist/cjs/image-q.js` - CommonJS\n - `dist/esm/image-q.js` - ESM (ESNext)\n - `dist/cjs/image-q.js` - UMD\n\n4. Import\n - `HTMLImageElement`\n - `HTMLCanvasElement`\n - `NodeCanvas`\n - `ImageData`\n - `Array`\n - `CanvasPixelArray`\n - `Uint8Array`\n - `Uint32Array`\n5. Color Distance\n\n - `Euclidean` - 1/1/1/1 coefficients (originally used in Xiaolin Wu's Quantizer **WuQuant**)\n - `EuclideanBT709NoAlpha` - BT.709 sRGB coefficients (originally used in **RGBQuant**)\n - `EuclideanBT709` BT.709 sRGB coefficients + alpha support\n - `Manhattan` - 1/1/1/1 coefficients (originally used in **NeuQuant**)\n - `ManhattanBT709` - BT.709 sRGB coefficients\n - `ManhattanNommyde` - see https://github.com/igor-bezkrovny/image-quantization/issues/4#issuecomment-234527620\n - `CIEDE2000` - CIEDE2000 (very slow)\n - `CIE94Textiles` - CIE94 implementation for textiles\n - `CIE94GraphicArts` - CIE94 implementation for graphic arts\n - `CMetric` - see http://www.compuphase.com/cmetric.htm\n - `PNGQuant` - used in pngQuant tool\n\n6. Palette Quantizers\n - `NeuQuant` (original code ported, integer calculations)\n - `NeuQuantFloat` (floating-point calculations)\n - `RGBQuant`\n - `WuQuant`\n7. Image Quantizers\n\n - `NearestColor`\n - `ErrorDiffusionArray` - two modes of error propagation are supported: `xnview` and `gimp`\n 1. `FloydSteinberg`\n 2. `FalseFloydSteinberg`\n 3. `Stucki`\n 4. `Atkinson`\n 5. `Jarvis`\n 6. `Burkes`\n 7. `Sierra`\n 8. `TwoSierra`\n 9. `SierraLite`\n - `ErrorDiffusionRiemersma` - Hilbert space-filling curve is used\n\n8. Output\n - `Uint32Array`\n - `Uint8Array`\n\n## Include `image-q` library into your project\n\n##### ES6 module\n\n```javascript\n// will import ESM (ESNext) or UMD version depending on your bundler/node\nimport * as iq from 'image-q';\n```\n\n##### CommonJS\n\n```javascript\nvar iq = require('image-q');\n```\n\n##### As a global variable (Browser)\n\n```html\n<script\n src=\"<path-to image-q/dist/umd/image-q.js>\"\n type=\"text/javascript\"\n charset=\"utf-8\"\n></script>\n```\n\n## How to use\n\nPlease refer to [API Documentation and Usage](http://ibezkrovnyi.github.io/image-quantization/)\n\n## Breaking changes\n\n#### 2.1.1\n\n + PaletteQuantizer#quantize => PaletteQuantizer#quantizeSync\n + ImageQuantizer#quantize => ImageQuantizer#quantizeSync\n\n#### 2.0.1 - 2.0.4 (2018-02-22)\n\n + EuclideanRgbQuantWOAlpha => EuclideanBT709NoAlpha\n + EuclideanRgbQuantWithAlpha => EuclideanBT709\n \t+ ManhattanSRGB => ManhattanBT709\n \t+ IImageDitherer => AbstractImageQuantizer\n \t+ IPaletteQuantizer => AbstractPaletteQuantizer\n \t+ PointContainer.fromNodeCanvas => PointContainer.fromHTMLCanvasElement\n \t+ PointContainer.fromArray => PointContainer.fromUint8Array\n + PointContainer.fromBuffer (Node.js, new)\n \t+ CMETRIC => CMetric\n \t+ PNGQUANT => PNGQuant\n \t+ SSIM Class => ssim function\n\n## TODO\n\n1. ~~notification about progress~~\n2. ~~riemersma dithering~~\n3. ordered dithering <-- is there anyone who needs it?\n4. readme update, more examples\n5. demo update (latest image-q npm version should be used in demo)\n\n## Changelog\n\n##### 4.0.0\n + Test cases for different types of imports and requres added\n\n##### 4.0.0-alpha\n + Try to solve exported bundle types problem. 'umd' bundle removed.\n\n#Line truncated
|
||||
}
|
||||
+287
@@ -0,0 +1,287 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* helper.ts - part of Image Quantization Library
|
||||
*/
|
||||
import * as distance from './distance';
|
||||
import * as image from './image';
|
||||
import * as palette from './palette';
|
||||
import { AbstractDistanceCalculator } from './distance/distanceCalculator';
|
||||
import { PointContainer } from './utils/pointContainer';
|
||||
import { Palette } from './utils/palette';
|
||||
|
||||
const setImmediateImpl =
|
||||
typeof setImmediate === 'function'
|
||||
? setImmediate
|
||||
: typeof process !== 'undefined' && typeof process?.nextTick === 'function'
|
||||
? (callback: () => void) => process.nextTick(callback)
|
||||
: (callback: () => void) => setTimeout(callback, 0);
|
||||
|
||||
export type ColorDistanceFormula =
|
||||
| 'cie94-textiles'
|
||||
| 'cie94-graphic-arts'
|
||||
| 'ciede2000'
|
||||
| 'color-metric'
|
||||
| 'euclidean'
|
||||
| 'euclidean-bt709-noalpha'
|
||||
| 'euclidean-bt709'
|
||||
| 'manhattan'
|
||||
| 'manhattan-bt709'
|
||||
| 'manhattan-nommyde'
|
||||
| 'pngquant';
|
||||
|
||||
export type PaletteQuantization =
|
||||
| 'neuquant'
|
||||
| 'neuquant-float'
|
||||
| 'rgbquant'
|
||||
| 'wuquant';
|
||||
|
||||
export type ImageQuantization =
|
||||
| 'nearest'
|
||||
| 'riemersma'
|
||||
| 'floyd-steinberg'
|
||||
| 'false-floyd-steinberg'
|
||||
| 'stucki'
|
||||
| 'atkinson'
|
||||
| 'jarvis'
|
||||
| 'burkes'
|
||||
| 'sierra'
|
||||
| 'two-sierra'
|
||||
| 'sierra-lite';
|
||||
|
||||
export interface ProgressOptions {
|
||||
onProgress?: (progress: number) => void;
|
||||
}
|
||||
|
||||
export interface ApplyPaletteOptions {
|
||||
colorDistanceFormula?: ColorDistanceFormula;
|
||||
imageQuantization?: ImageQuantization;
|
||||
}
|
||||
|
||||
export interface BuildPaletteOptions {
|
||||
colorDistanceFormula?: ColorDistanceFormula;
|
||||
paletteQuantization?: PaletteQuantization;
|
||||
colors?: number;
|
||||
}
|
||||
|
||||
export function buildPaletteSync(
|
||||
images: PointContainer[],
|
||||
{
|
||||
colorDistanceFormula,
|
||||
paletteQuantization,
|
||||
colors,
|
||||
}: BuildPaletteOptions = {},
|
||||
) {
|
||||
const distanceCalculator =
|
||||
colorDistanceFormulaToColorDistance(colorDistanceFormula);
|
||||
const paletteQuantizer = paletteQuantizationToPaletteQuantizer(
|
||||
distanceCalculator,
|
||||
paletteQuantization,
|
||||
colors,
|
||||
);
|
||||
images.forEach((image) => paletteQuantizer.sample(image));
|
||||
return paletteQuantizer.quantizeSync();
|
||||
}
|
||||
|
||||
export async function buildPalette(
|
||||
images: PointContainer[],
|
||||
{
|
||||
colorDistanceFormula,
|
||||
paletteQuantization,
|
||||
colors,
|
||||
onProgress,
|
||||
}: BuildPaletteOptions & ProgressOptions = {},
|
||||
) {
|
||||
return new Promise<Palette>((resolve, reject) => {
|
||||
const distanceCalculator =
|
||||
colorDistanceFormulaToColorDistance(colorDistanceFormula);
|
||||
const paletteQuantizer = paletteQuantizationToPaletteQuantizer(
|
||||
distanceCalculator,
|
||||
paletteQuantization,
|
||||
colors,
|
||||
);
|
||||
images.forEach((image) => paletteQuantizer.sample(image));
|
||||
|
||||
let palette: Palette;
|
||||
const iterator = paletteQuantizer.quantize();
|
||||
const next = () => {
|
||||
try {
|
||||
const result = iterator.next();
|
||||
if (result.done) {
|
||||
resolve(palette);
|
||||
} else {
|
||||
if (result.value.palette) palette = result.value.palette;
|
||||
if (onProgress) onProgress(result.value.progress);
|
||||
setImmediateImpl(next);
|
||||
}
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
};
|
||||
setImmediateImpl(next);
|
||||
});
|
||||
}
|
||||
|
||||
export function applyPaletteSync(
|
||||
image: PointContainer,
|
||||
palette: Palette,
|
||||
{ colorDistanceFormula, imageQuantization }: ApplyPaletteOptions = {},
|
||||
) {
|
||||
const distanceCalculator =
|
||||
colorDistanceFormulaToColorDistance(colorDistanceFormula);
|
||||
const imageQuantizer = imageQuantizationToImageQuantizer(
|
||||
distanceCalculator,
|
||||
imageQuantization,
|
||||
);
|
||||
return imageQuantizer.quantizeSync(image, palette);
|
||||
}
|
||||
|
||||
export async function applyPalette(
|
||||
image: PointContainer,
|
||||
palette: Palette,
|
||||
{
|
||||
colorDistanceFormula,
|
||||
imageQuantization,
|
||||
onProgress,
|
||||
}: ApplyPaletteOptions & ProgressOptions = {},
|
||||
) {
|
||||
return new Promise<PointContainer>((resolve, reject) => {
|
||||
const distanceCalculator =
|
||||
colorDistanceFormulaToColorDistance(colorDistanceFormula);
|
||||
const imageQuantizer = imageQuantizationToImageQuantizer(
|
||||
distanceCalculator,
|
||||
imageQuantization,
|
||||
);
|
||||
|
||||
let outPointContainer: PointContainer;
|
||||
const iterator = imageQuantizer.quantize(image, palette);
|
||||
const next = () => {
|
||||
try {
|
||||
const result = iterator.next();
|
||||
if (result.done) {
|
||||
resolve(outPointContainer);
|
||||
} else {
|
||||
if (result.value.pointContainer) {
|
||||
outPointContainer = result.value.pointContainer;
|
||||
}
|
||||
if (onProgress) onProgress(result.value.progress);
|
||||
setImmediateImpl(next);
|
||||
}
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
};
|
||||
setImmediateImpl(next);
|
||||
});
|
||||
}
|
||||
|
||||
function colorDistanceFormulaToColorDistance(
|
||||
colorDistanceFormula: ColorDistanceFormula = 'euclidean-bt709',
|
||||
) {
|
||||
switch (colorDistanceFormula) {
|
||||
case 'cie94-graphic-arts':
|
||||
return new distance.CIE94GraphicArts();
|
||||
case 'cie94-textiles':
|
||||
return new distance.CIE94Textiles();
|
||||
case 'ciede2000':
|
||||
return new distance.CIEDE2000();
|
||||
case 'color-metric':
|
||||
return new distance.CMetric();
|
||||
case 'euclidean':
|
||||
return new distance.Euclidean();
|
||||
case 'euclidean-bt709':
|
||||
return new distance.EuclideanBT709();
|
||||
case 'euclidean-bt709-noalpha':
|
||||
return new distance.EuclideanBT709NoAlpha();
|
||||
case 'manhattan':
|
||||
return new distance.Manhattan();
|
||||
case 'manhattan-bt709':
|
||||
return new distance.ManhattanBT709();
|
||||
case 'manhattan-nommyde':
|
||||
return new distance.ManhattanNommyde();
|
||||
case 'pngquant':
|
||||
return new distance.PNGQuant();
|
||||
default:
|
||||
throw new Error(`Unknown colorDistanceFormula ${colorDistanceFormula}`);
|
||||
}
|
||||
}
|
||||
|
||||
function imageQuantizationToImageQuantizer(
|
||||
distanceCalculator: AbstractDistanceCalculator,
|
||||
imageQuantization: ImageQuantization = 'floyd-steinberg',
|
||||
) {
|
||||
switch (imageQuantization) {
|
||||
case 'nearest':
|
||||
return new image.NearestColor(distanceCalculator);
|
||||
case 'riemersma':
|
||||
return new image.ErrorDiffusionRiemersma(distanceCalculator);
|
||||
case 'floyd-steinberg':
|
||||
return new image.ErrorDiffusionArray(
|
||||
distanceCalculator,
|
||||
image.ErrorDiffusionArrayKernel.FloydSteinberg,
|
||||
);
|
||||
case 'false-floyd-steinberg':
|
||||
return new image.ErrorDiffusionArray(
|
||||
distanceCalculator,
|
||||
image.ErrorDiffusionArrayKernel.FalseFloydSteinberg,
|
||||
);
|
||||
case 'stucki':
|
||||
return new image.ErrorDiffusionArray(
|
||||
distanceCalculator,
|
||||
image.ErrorDiffusionArrayKernel.Stucki,
|
||||
);
|
||||
case 'atkinson':
|
||||
return new image.ErrorDiffusionArray(
|
||||
distanceCalculator,
|
||||
image.ErrorDiffusionArrayKernel.Atkinson,
|
||||
);
|
||||
case 'jarvis':
|
||||
return new image.ErrorDiffusionArray(
|
||||
distanceCalculator,
|
||||
image.ErrorDiffusionArrayKernel.Jarvis,
|
||||
);
|
||||
case 'burkes':
|
||||
return new image.ErrorDiffusionArray(
|
||||
distanceCalculator,
|
||||
image.ErrorDiffusionArrayKernel.Burkes,
|
||||
);
|
||||
case 'sierra':
|
||||
return new image.ErrorDiffusionArray(
|
||||
distanceCalculator,
|
||||
image.ErrorDiffusionArrayKernel.Sierra,
|
||||
);
|
||||
case 'two-sierra':
|
||||
return new image.ErrorDiffusionArray(
|
||||
distanceCalculator,
|
||||
image.ErrorDiffusionArrayKernel.TwoSierra,
|
||||
);
|
||||
case 'sierra-lite':
|
||||
return new image.ErrorDiffusionArray(
|
||||
distanceCalculator,
|
||||
image.ErrorDiffusionArrayKernel.SierraLite,
|
||||
);
|
||||
default:
|
||||
throw new Error(`Unknown imageQuantization ${imageQuantization}`);
|
||||
}
|
||||
}
|
||||
|
||||
function paletteQuantizationToPaletteQuantizer(
|
||||
distanceCalculator: AbstractDistanceCalculator,
|
||||
paletteQuantization: PaletteQuantization = 'wuquant',
|
||||
colors = 256,
|
||||
) {
|
||||
switch (paletteQuantization) {
|
||||
case 'neuquant':
|
||||
return new palette.NeuQuant(distanceCalculator, colors);
|
||||
case 'rgbquant':
|
||||
return new palette.RGBQuant(distanceCalculator, colors);
|
||||
case 'wuquant':
|
||||
return new palette.WuQuant(distanceCalculator, colors);
|
||||
case 'neuquant-float':
|
||||
return new palette.NeuQuantFloat(distanceCalculator, colors);
|
||||
default:
|
||||
throw new Error(`Unknown paletteQuantization ${paletteQuantization}`);
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* constants.ts - part of Image Quantization Library
|
||||
*/
|
||||
|
||||
/**
|
||||
* sRGB (based on ITU-R Recommendation BT.709)
|
||||
* http://en.wikipedia.org/wiki/SRGB
|
||||
*/
|
||||
export enum Y {
|
||||
RED = 0.2126,
|
||||
GREEN = 0.7152,
|
||||
BLUE = 0.0722,
|
||||
WHITE = 1,
|
||||
}
|
||||
|
||||
export enum x {
|
||||
RED = 0.64,
|
||||
GREEN = 0.3,
|
||||
BLUE = 0.15,
|
||||
WHITE = 0.3127,
|
||||
}
|
||||
|
||||
export enum y {
|
||||
RED = 0.33,
|
||||
GREEN = 0.6,
|
||||
BLUE = 0.06,
|
||||
WHITE = 0.329,
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* constants.ts - part of Image Quantization Library
|
||||
*/
|
||||
import * as bt709 from './bt709';
|
||||
|
||||
export { bt709 };
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* iq.ts - Image Quantization Library
|
||||
*/
|
||||
export { rgb2xyz } from './rgb2xyz';
|
||||
export { rgb2hsl } from './rgb2hsl';
|
||||
export { rgb2lab } from './rgb2lab';
|
||||
export { lab2xyz } from './lab2xyz';
|
||||
export { lab2rgb } from './lab2rgb';
|
||||
export { xyz2lab } from './xyz2lab';
|
||||
export { xyz2rgb } from './xyz2rgb';
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @preserve
|
||||
* Copyright 2015-2018 Igor Bezkrovnyi
|
||||
* All rights reserved. (MIT Licensed)
|
||||
*
|
||||
* lab2rgb.ts - part of Image Quantization Library
|
||||
*/
|
||||
import { lab2xyz } from './lab2xyz';
|
||||
import { xyz2rgb } from './xyz2rgb';
|
||||
|
||||
export function lab2rgb(L: number, a: number, b: number) {
|
||||
const xyz = lab2xyz(L, a, b);
|
||||
return xyz2rgb(xyz.x, xyz.y, xyz.z);
|
||||
}
|
||||
Loaded 100 of 5445 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user