yeet
This commit is contained in:
47
node_modules/@jimp/jpeg/CHANGELOG.md
generated
vendored
Normal file
47
node_modules/@jimp/jpeg/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
# v0.12.1 (Tue May 19 2020)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- update jpeg-js [#892](https://github.com/oliver-moran/jimp/pull/892) ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
---
|
||||
|
||||
# v0.11.0 (Fri May 15 2020)
|
||||
|
||||
#### 🚀 Enhancement
|
||||
|
||||
- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Eric Rabil ([@EricRabil](https://github.com/EricRabil))
|
||||
|
||||
---
|
||||
|
||||
# v0.10.0 (Mon Mar 30 2020)
|
||||
|
||||
#### 🚀 Enhancement
|
||||
|
||||
- Properly split constructor and instance types [#867](https://github.com/oliver-moran/jimp/pull/867) ([@forivall](https://github.com/forivall))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Emily Marigold Klassen ([@forivall](https://github.com/forivall))
|
||||
|
||||
---
|
||||
|
||||
# v0.9.3 (Tue Nov 26 2019)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils`
|
||||
- Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
#### Authors: 2
|
||||
|
||||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn))
|
21
node_modules/@jimp/jpeg/LICENSE
generated
vendored
Normal file
21
node_modules/@jimp/jpeg/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Oliver Moran
|
||||
|
||||
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.
|
12
node_modules/@jimp/jpeg/README.md
generated
vendored
Normal file
12
node_modules/@jimp/jpeg/README.md
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
<div align="center">
|
||||
<img width="200" height="200"
|
||||
src="https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-11/256/crayon.png">
|
||||
<h1>@jimp/jpeg</h1>
|
||||
<p>Default Jimp jpeg encoder/decoder.</p>
|
||||
</div>
|
||||
|
||||
## Available Methods
|
||||
|
||||
### Jimp.quality
|
||||
|
||||
Sets the quality of the image when saving as JPEG format (default is 100)
|
61
node_modules/@jimp/jpeg/dist/index.js
generated
vendored
Normal file
61
node_modules/@jimp/jpeg/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
||||
|
||||
var _jpegJs = _interopRequireDefault(require("jpeg-js"));
|
||||
|
||||
var _utils = require("@jimp/utils");
|
||||
|
||||
var MIME_TYPE = 'image/jpeg';
|
||||
|
||||
var _default = function _default() {
|
||||
return {
|
||||
mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['jpeg', 'jpg', 'jpe']),
|
||||
constants: {
|
||||
MIME_JPEG: MIME_TYPE
|
||||
},
|
||||
decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _jpegJs["default"].decode),
|
||||
encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) {
|
||||
return _jpegJs["default"].encode(image.bitmap, image._quality).data;
|
||||
}),
|
||||
"class": {
|
||||
// The quality to be used when saving JPEG images
|
||||
_quality: 100,
|
||||
|
||||
/**
|
||||
* Sets the quality of the image when saving as JPEG format (default is 100)
|
||||
* @param {number} n The quality to use 0-100
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
quality: function quality(n, cb) {
|
||||
if (typeof n !== 'number') {
|
||||
return _utils.throwError.call(this, 'n must be a number', cb);
|
||||
}
|
||||
|
||||
if (n < 0 || n > 100) {
|
||||
return _utils.throwError.call(this, 'n must be a number 0 - 100', cb);
|
||||
}
|
||||
|
||||
this._quality = Math.round(n);
|
||||
|
||||
if ((0, _utils.isNodePattern)(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports["default"] = _default;
|
||||
module.exports = exports.default;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@jimp/jpeg/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@jimp/jpeg/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_JPEG","decoders","JPEG","decode","encoders","image","encode","bitmap","_quality","data","quality","n","cb","throwError","call","Math","round"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,EAAgB,KAAhB,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACOK,mBAAKC,MADZ,CAPY;AAWpBC,IAAAA,QAAQ,uCACLP,SADK,EACO,UAAAQ,KAAK;AAAA,aAAIH,mBAAKI,MAAL,CAAYD,KAAK,CAACE,MAAlB,EAA0BF,KAAK,CAACG,QAAhC,EAA0CC,IAA9C;AAAA,KADZ,CAXY;AAepB,aAAO;AACL;AACAD,MAAAA,QAAQ,EAAE,GAFL;;AAGL;;;;;;AAMAE,MAAAA,OATK,mBASGC,CATH,EASMC,EATN,EASU;AACb,YAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,YAAID,CAAC,GAAG,CAAJ,IAASA,CAAC,GAAG,GAAjB,EAAsB;AACpB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,4BAAtB,EAAoDF,EAApD,CAAP;AACD;;AAED,aAAKJ,QAAL,GAAgBO,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAhB;;AAEA,YAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzBI;AAfa,GAAP;AAAA,C","sourcesContent":["import JPEG from 'jpeg-js';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/jpeg';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['jpeg', 'jpg', 'jpe'] },\n\n constants: {\n MIME_JPEG: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: JPEG.decode\n },\n\n encoders: {\n [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data\n },\n\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (n < 0 || n > 100) {\n return throwError.call(this, 'n must be a number 0 - 100', cb);\n }\n\n this._quality = Math.round(n);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"}
|
60
node_modules/@jimp/jpeg/es/index.js
generated
vendored
Normal file
60
node_modules/@jimp/jpeg/es/index.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
||||
|
||||
var _jpegJs = _interopRequireDefault(require("jpeg-js"));
|
||||
|
||||
var _utils = require("@jimp/utils");
|
||||
|
||||
var MIME_TYPE = 'image/jpeg';
|
||||
|
||||
var _default = function _default() {
|
||||
return {
|
||||
mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['jpeg', 'jpg', 'jpe']),
|
||||
constants: {
|
||||
MIME_JPEG: MIME_TYPE
|
||||
},
|
||||
decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _jpegJs["default"].decode),
|
||||
encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) {
|
||||
return _jpegJs["default"].encode(image.bitmap, image._quality).data;
|
||||
}),
|
||||
"class": {
|
||||
// The quality to be used when saving JPEG images
|
||||
_quality: 100,
|
||||
|
||||
/**
|
||||
* Sets the quality of the image when saving as JPEG format (default is 100)
|
||||
* @param {number} n The quality to use 0-100
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
quality: function quality(n, cb) {
|
||||
if (typeof n !== 'number') {
|
||||
return _utils.throwError.call(this, 'n must be a number', cb);
|
||||
}
|
||||
|
||||
if (n < 0 || n > 100) {
|
||||
return _utils.throwError.call(this, 'n must be a number 0 - 100', cb);
|
||||
}
|
||||
|
||||
this._quality = Math.round(n);
|
||||
|
||||
if ((0, _utils.isNodePattern)(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports["default"] = _default;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@jimp/jpeg/es/index.js.map
generated
vendored
Normal file
1
node_modules/@jimp/jpeg/es/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_JPEG","decoders","JPEG","decode","encoders","image","encode","bitmap","_quality","data","quality","n","cb","throwError","call","Math","round"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,EAAgB,KAAhB,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACOK,mBAAKC,MADZ,CAPY;AAWpBC,IAAAA,QAAQ,uCACLP,SADK,EACO,UAAAQ,KAAK;AAAA,aAAIH,mBAAKI,MAAL,CAAYD,KAAK,CAACE,MAAlB,EAA0BF,KAAK,CAACG,QAAhC,EAA0CC,IAA9C;AAAA,KADZ,CAXY;AAepB,aAAO;AACL;AACAD,MAAAA,QAAQ,EAAE,GAFL;;AAGL;;;;;;AAMAE,MAAAA,OATK,mBASGC,CATH,EASMC,EATN,EASU;AACb,YAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,YAAID,CAAC,GAAG,CAAJ,IAASA,CAAC,GAAG,GAAjB,EAAsB;AACpB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,4BAAtB,EAAoDF,EAApD,CAAP;AACD;;AAED,aAAKJ,QAAL,GAAgBO,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAhB;;AAEA,YAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzBI;AAfa,GAAP;AAAA,C","sourcesContent":["import JPEG from 'jpeg-js';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/jpeg';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['jpeg', 'jpg', 'jpe'] },\n\n constants: {\n MIME_JPEG: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: JPEG.decode\n },\n\n encoders: {\n [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data\n },\n\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (n < 0 || n > 100) {\n return throwError.call(this, 'n must be a number 0 - 100', cb);\n }\n\n this._quality = Math.round(n);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"}
|
26
node_modules/@jimp/jpeg/index.d.ts
generated
vendored
Normal file
26
node_modules/@jimp/jpeg/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
import { DecoderFn, EncoderFn, ImageCallback } from '@jimp/core';
|
||||
|
||||
interface JpegClass {
|
||||
_quality: number;
|
||||
quality: (n: number, cb?: ImageCallback<this>) => this;
|
||||
}
|
||||
|
||||
interface Jpeg {
|
||||
mime: { 'image/jpeg': string[] },
|
||||
|
||||
constants: {
|
||||
MIME_JPEG: 'image/jpeg';
|
||||
}
|
||||
|
||||
encoders: {
|
||||
'image/jpeg': EncoderFn
|
||||
}
|
||||
|
||||
decoders: {
|
||||
'image/jpeg': DecoderFn
|
||||
}
|
||||
|
||||
class: JpegClass
|
||||
}
|
||||
|
||||
export default function(): Jpeg;
|
38
node_modules/@jimp/jpeg/package.json
generated
vendored
Normal file
38
node_modules/@jimp/jpeg/package.json
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "@jimp/jpeg",
|
||||
"version": "0.12.1",
|
||||
"description": "Default Jimp jpeg encoder/decoder.",
|
||||
"main": "dist/index.js",
|
||||
"module": "es/index.js",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"test": "cross-env BABEL_ENV=test mocha --require @babel/register",
|
||||
"test:watch": "npm run test -- --reporter min --watch",
|
||||
"test:coverage": "nyc npm run test",
|
||||
"build": "npm run build:node:production && npm run build:module",
|
||||
"build:watch": "npm run build:node:debug -- -- --watch --verbose",
|
||||
"build:debug": "npm run build:node:debug",
|
||||
"build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js",
|
||||
"build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js",
|
||||
"build:node:debug": "cross-env BABEL_ENV=development npm run build:node",
|
||||
"build:node:production": "cross-env BABEL_ENV=production npm run build:node"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.2",
|
||||
"@jimp/utils": "^0.12.1",
|
||||
"jpeg-js": "^0.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@jimp/custom": ">=0.3.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jimp/custom": "^0.12.1",
|
||||
"@jimp/test-utils": "^0.12.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "942e635564e36fc243767531b4f8be036afa40b5"
|
||||
}
|
48
node_modules/@jimp/jpeg/src/index.js
generated
vendored
Normal file
48
node_modules/@jimp/jpeg/src/index.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
import JPEG from 'jpeg-js';
|
||||
import { throwError, isNodePattern } from '@jimp/utils';
|
||||
|
||||
const MIME_TYPE = 'image/jpeg';
|
||||
|
||||
export default () => ({
|
||||
mime: { [MIME_TYPE]: ['jpeg', 'jpg', 'jpe'] },
|
||||
|
||||
constants: {
|
||||
MIME_JPEG: MIME_TYPE
|
||||
},
|
||||
|
||||
decoders: {
|
||||
[MIME_TYPE]: JPEG.decode
|
||||
},
|
||||
|
||||
encoders: {
|
||||
[MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data
|
||||
},
|
||||
|
||||
class: {
|
||||
// The quality to be used when saving JPEG images
|
||||
_quality: 100,
|
||||
/**
|
||||
* Sets the quality of the image when saving as JPEG format (default is 100)
|
||||
* @param {number} n The quality to use 0-100
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
quality(n, cb) {
|
||||
if (typeof n !== 'number') {
|
||||
return throwError.call(this, 'n must be a number', cb);
|
||||
}
|
||||
|
||||
if (n < 0 || n > 100) {
|
||||
return throwError.call(this, 'n must be a number 0 - 100', cb);
|
||||
}
|
||||
|
||||
this._quality = Math.round(n);
|
||||
|
||||
if (isNodePattern(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
});
|
BIN
node_modules/@jimp/jpeg/test/images/cops.jpg
generated
vendored
Normal file
BIN
node_modules/@jimp/jpeg/test/images/cops.jpg
generated
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
BIN
node_modules/@jimp/jpeg/test/images/fillbytes.jpg
generated
vendored
Normal file
BIN
node_modules/@jimp/jpeg/test/images/fillbytes.jpg
generated
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
48
node_modules/@jimp/jpeg/test/jpeg.test.js
generated
vendored
Normal file
48
node_modules/@jimp/jpeg/test/jpeg.test.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
import { Jimp, getTestDir } from '@jimp/test-utils';
|
||||
import configure from '@jimp/custom';
|
||||
|
||||
import jpeg from '../src';
|
||||
|
||||
const jimp = configure({ types: [jpeg] }, Jimp);
|
||||
|
||||
describe('JPEG', () => {
|
||||
const imagesDir = getTestDir(__dirname) + '/images';
|
||||
|
||||
it('load JPG', async () => {
|
||||
const image = await jimp.read(imagesDir + '/cops.jpg');
|
||||
|
||||
image.getPixelColor(10, 10).should.be.equal(0x3f4a02ff);
|
||||
image.getPixelColor(220, 190).should.be.equal(0x5d94b6ff);
|
||||
image.getPixelColor(350, 130).should.be.equal(0xdf7944ff);
|
||||
});
|
||||
|
||||
it('load JPG with fill bytes', async () => {
|
||||
const image = await jimp.read(imagesDir + '/fillbytes.jpg');
|
||||
|
||||
image.getPixelColor(10, 10).should.be.equal(0xaeb8c3ff);
|
||||
image.getPixelColor(220, 190).should.be.equal(0x262b21ff);
|
||||
image.getPixelColor(350, 130).should.be.equal(0x4e5d30ff);
|
||||
});
|
||||
|
||||
it('export JPG', async () => {
|
||||
const image = await jimp.read({
|
||||
width: 3,
|
||||
height: 3,
|
||||
data: [
|
||||
0xff0000ff,
|
||||
0xff0080ff,
|
||||
0xff00ffff,
|
||||
0xff0080ff,
|
||||
0xff00ffff,
|
||||
0x8000ffff,
|
||||
0xff00ffff,
|
||||
0x8000ffff,
|
||||
0x0000ffff
|
||||
]
|
||||
});
|
||||
image.quality(50);
|
||||
const buffer = await image.getBufferAsync('image/jpeg');
|
||||
|
||||
buffer.toString().should.match(/^.{3,9}JFIF\u0000/);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user