chore: add jimp dependency, icon padding script, and update configuration
This commit is contained in:
+71
@@ -0,0 +1,71 @@
|
||||
# v0.22.1 (Mon Feb 06 2023)
|
||||
|
||||
#### 🏠 Internal
|
||||
|
||||
- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
---
|
||||
|
||||
# v0.21.0 (Sun Feb 05 2023)
|
||||
|
||||
### Release Notes
|
||||
|
||||
#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149))
|
||||
|
||||
Marking this as a "breaking release" because it might change what deps need to be installed.
|
||||
|
||||
All modules should be exported as valid cjs and esm
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
#### 💥 Breaking Change
|
||||
|
||||
- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
---
|
||||
|
||||
# v0.16.3 (Sat Feb 04 2023)
|
||||
|
||||
#### ⚠️ Pushed to `main`
|
||||
|
||||
- upgrade prettier ([@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.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
@@ -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.
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<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/plugin-gaussian</h1>
|
||||
<p>Gaussian blur an image.</p>
|
||||
</div>
|
||||
|
||||
Applies a true Gaussian blur to the image (warning: this is VERY slow)
|
||||
|
||||
## Usage
|
||||
|
||||
- @param {number} r the pixel radius of the blur
|
||||
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
|
||||
```js
|
||||
import jimp from "jimp";
|
||||
|
||||
async function main() {
|
||||
const image = await jimp.read("test/image.png");
|
||||
|
||||
image.gaussian(15);
|
||||
}
|
||||
|
||||
main();
|
||||
```
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
import { isNodePattern, throwError } from "@jimp/utils";
|
||||
|
||||
/**
|
||||
* Applies a true Gaussian blur to the image (warning: this is VERY slow)
|
||||
* @param {number} r the pixel radius of the blur
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
export default (() => ({
|
||||
gaussian(r, cb) {
|
||||
// http://blog.ivank.net/fastest-gaussian-blur.html
|
||||
if (typeof r !== "number") {
|
||||
return throwError.call(this, "r must be a number", cb);
|
||||
}
|
||||
if (r < 1) {
|
||||
return throwError.call(this, "r must be greater than 0", cb);
|
||||
}
|
||||
const rs = Math.ceil(r * 2.57); // significant radius
|
||||
const range = rs * 2 + 1;
|
||||
const rr2 = r * r * 2;
|
||||
const rr2pi = rr2 * Math.PI;
|
||||
const weights = [];
|
||||
for (let y = 0; y < range; y++) {
|
||||
weights[y] = [];
|
||||
for (let x = 0; x < range; x++) {
|
||||
const dsq = (x - rs) ** 2 + (y - rs) ** 2;
|
||||
weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;
|
||||
}
|
||||
}
|
||||
for (let y = 0; y < this.bitmap.height; y++) {
|
||||
for (let x = 0; x < this.bitmap.width; x++) {
|
||||
let red = 0;
|
||||
let green = 0;
|
||||
let blue = 0;
|
||||
let alpha = 0;
|
||||
let wsum = 0;
|
||||
for (let iy = 0; iy < range; iy++) {
|
||||
for (let ix = 0; ix < range; ix++) {
|
||||
const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs));
|
||||
const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs));
|
||||
const weight = weights[iy][ix];
|
||||
const idx = y1 * this.bitmap.width + x1 << 2;
|
||||
red += this.bitmap.data[idx] * weight;
|
||||
green += this.bitmap.data[idx + 1] * weight;
|
||||
blue += this.bitmap.data[idx + 2] * weight;
|
||||
alpha += this.bitmap.data[idx + 3] * weight;
|
||||
wsum += weight;
|
||||
}
|
||||
const idx = y * this.bitmap.width + x << 2;
|
||||
this.bitmap.data[idx] = Math.round(red / wsum);
|
||||
this.bitmap.data[idx + 1] = Math.round(green / wsum);
|
||||
this.bitmap.data[idx + 2] = Math.round(blue / wsum);
|
||||
this.bitmap.data[idx + 3] = Math.round(alpha / wsum);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isNodePattern(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}));
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+7
@@ -0,0 +1,7 @@
|
||||
import { ImageCallback } from "@jimp/core";
|
||||
|
||||
interface Gaussian {
|
||||
gaussian(r: number, cb?: ImageCallback<this>): this;
|
||||
}
|
||||
|
||||
export default function (): Gaussian;
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "@jimp/plugin-gaussian",
|
||||
"version": "0.22.12",
|
||||
"description": "gaussian blur an image.",
|
||||
"main": "dist/index.js",
|
||||
"module": "es/index.js",
|
||||
"repository": "jimp-dev/jimp",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"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": {
|
||||
"@jimp/utils": "^0.22.12"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@jimp/custom": ">=0.3.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
import { isNodePattern, throwError } from "@jimp/utils";
|
||||
|
||||
/**
|
||||
* Applies a true Gaussian blur to the image (warning: this is VERY slow)
|
||||
* @param {number} r the pixel radius of the blur
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
export default () => ({
|
||||
gaussian(r, cb) {
|
||||
// http://blog.ivank.net/fastest-gaussian-blur.html
|
||||
if (typeof r !== "number") {
|
||||
return throwError.call(this, "r must be a number", cb);
|
||||
}
|
||||
|
||||
if (r < 1) {
|
||||
return throwError.call(this, "r must be greater than 0", cb);
|
||||
}
|
||||
|
||||
const rs = Math.ceil(r * 2.57); // significant radius
|
||||
const range = rs * 2 + 1;
|
||||
const rr2 = r * r * 2;
|
||||
const rr2pi = rr2 * Math.PI;
|
||||
|
||||
const weights = [];
|
||||
|
||||
for (let y = 0; y < range; y++) {
|
||||
weights[y] = [];
|
||||
for (let x = 0; x < range; x++) {
|
||||
const dsq = (x - rs) ** 2 + (y - rs) ** 2;
|
||||
weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;
|
||||
}
|
||||
}
|
||||
|
||||
for (let y = 0; y < this.bitmap.height; y++) {
|
||||
for (let x = 0; x < this.bitmap.width; x++) {
|
||||
let red = 0;
|
||||
let green = 0;
|
||||
let blue = 0;
|
||||
let alpha = 0;
|
||||
let wsum = 0;
|
||||
|
||||
for (let iy = 0; iy < range; iy++) {
|
||||
for (let ix = 0; ix < range; ix++) {
|
||||
const x1 = Math.min(
|
||||
this.bitmap.width - 1,
|
||||
Math.max(0, ix + x - rs)
|
||||
);
|
||||
const y1 = Math.min(
|
||||
this.bitmap.height - 1,
|
||||
Math.max(0, iy + y - rs)
|
||||
);
|
||||
const weight = weights[iy][ix];
|
||||
const idx = (y1 * this.bitmap.width + x1) << 2;
|
||||
|
||||
red += this.bitmap.data[idx] * weight;
|
||||
green += this.bitmap.data[idx + 1] * weight;
|
||||
blue += this.bitmap.data[idx + 2] * weight;
|
||||
alpha += this.bitmap.data[idx + 3] * weight;
|
||||
wsum += weight;
|
||||
}
|
||||
|
||||
const idx = (y * this.bitmap.width + x) << 2;
|
||||
|
||||
this.bitmap.data[idx] = Math.round(red / wsum);
|
||||
this.bitmap.data[idx + 1] = Math.round(green / wsum);
|
||||
this.bitmap.data[idx + 2] = Math.round(blue / wsum);
|
||||
this.bitmap.data[idx + 3] = Math.round(alpha / wsum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isNodePattern(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user