@jimp/jpeg
Advanced tools
Comparing version 0.20.2 to 0.21.0--canary.1149.3239903.0
"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")); | ||
exports.default = void 0; | ||
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; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const MIME_TYPE = "image/jpeg"; | ||
var _default = () => ({ | ||
mime: { | ||
[MIME_TYPE]: ["jpeg", "jpg", "jpe"] | ||
}, | ||
constants: { | ||
MIME_JPEG: MIME_TYPE | ||
}, | ||
decoders: { | ||
[MIME_TYPE]: _jpegJs.default.decode | ||
}, | ||
encoders: { | ||
[MIME_TYPE]: image => _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(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; | ||
} | ||
}); | ||
exports.default = _default; | ||
module.exports = exports.default; | ||
//# sourceMappingURL=index.js.map |
@@ -1,60 +0,41 @@ | ||
"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; | ||
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; | ||
} | ||
}; | ||
}; | ||
exports["default"] = _default; | ||
} | ||
})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@jimp/jpeg", | ||
"version": "0.20.2", | ||
"version": "0.21.0--canary.1149.3239903.0", | ||
"description": "Default Jimp jpeg encoder/decoder.", | ||
@@ -24,4 +24,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@babel/runtime": "^7.7.2", | ||
"@jimp/utils": "^0.20.2", | ||
"@jimp/utils": "0.21.0--canary.1149.3239903.0", | ||
"jpeg-js": "^0.4.4" | ||
@@ -33,4 +32,4 @@ }, | ||
"devDependencies": { | ||
"@jimp/custom": "^0.20.2", | ||
"@jimp/test-utils": "^0.20.2" | ||
"@jimp/custom": "0.21.0--canary.1149.3239903.0", | ||
"@jimp/test-utils": "0.21.0--canary.1149.3239903.0" | ||
}, | ||
@@ -40,3 +39,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "cebbdb72f889102a8e3c42b25ad3243b16e3a485" | ||
"gitHead": "323990352ce279d67297aed097b37bd8ec66ef51" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
163103
177
+ Added@jimp/utils@0.21.0--canary.1149.3239903.0(transitive)
- Removed@babel/runtime@^7.7.2
- Removed@babel/runtime@7.26.0(transitive)
- Removed@jimp/utils@0.20.2(transitive)
- Removedregenerator-runtime@0.14.1(transitive)