Skip to content

Commit edfd4ae

Browse files
Merge remote-tracking branch 'origin/main' into reset-exif
# Conflicts: # yarn.lock
2 parents 723424e + 65e3792 commit edfd4ae

File tree

46 files changed

+2639
-3121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2639
-3121
lines changed

.all-contributorsrc

+9
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,15 @@
13101310
"contributions": [
13111311
"code"
13121312
]
1313+
},
1314+
{
1315+
"login": "AnotherPillow",
1316+
"name": "AnotherPillow",
1317+
"avatar_url": "https://avatars.githubusercontent.com/u/85362273?v=4",
1318+
"profile": "https://github.com/AnotherPillow",
1319+
"contributions": [
1320+
"doc"
1321+
]
13131322
}
13141323
],
13151324
"contributorsPerLine": 7,

CHANGELOG.md

+29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
# v0.22.11 (Fri Feb 23 2024)
2+
3+
:tada: This release contains work from new contributors! :tada:
4+
5+
Thanks for all your work!
6+
7+
:heart: Rob Juurlink ([@kozmoz](https://github.com/kozmoz))
8+
9+
:heart: null[@AnotherPillow](https://github.com/AnotherPillow)
10+
11+
#### 🚀 Enhancement
12+
13+
- `@jimp/plugin-print`
14+
- Add \n support for image.print #865 [#1265](https://github.com/jimp-dev/jimp/pull/1265) ([email protected] [@kozmoz](https://github.com/kozmoz) [@hipstersmoothie](https://github.com/hipstersmoothie))
15+
16+
#### 📝 Documentation
17+
18+
- `jimp`
19+
- Fix it's/its, see description. [#1267](https://github.com/jimp-dev/jimp/pull/1267) ([@AnotherPillow](https://github.com/AnotherPillow))
20+
21+
#### Authors: 4
22+
23+
- [@AnotherPillow](https://github.com/AnotherPillow)
24+
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
25+
- juurr00 ([email protected])
26+
- Rob Juurlink ([@kozmoz](https://github.com/kozmoz))
27+
28+
---
29+
130
# v0.22.10 (Wed Jul 26 2023)
231

332
:tada: This release contains work from a new contributor! :tada:

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
src="https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-11/256/crayon.png">
44
<h1>Jimp</h1>
55
<p>JavaScript Image Manipulation Program</p>
6-
<p>An image processing library for Node written entirely in JavaScript, with zero native dependencies.</p>
6+
<p>An image processing library for Node written entirely in JavaScript, with zero native dependencies</p>
77
</div>
88

99
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
@@ -309,6 +309,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
309309
<td align="center"><a href="https://github.com/JunkMeal"><img src="https://avatars.githubusercontent.com/u/65283415?v=4?s=100" width="100px;" alt=""/><br /><sub><b>JunkMeal</b></sub></a><br /><a href="https://github.com/jimp-dev/jimp/commits?author=JunkMeal" title="Documentation">📖</a></td>
310310
<td align="center"><a href="https://github.com/Marsup"><img src="https://avatars.githubusercontent.com/u/796194?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nicolas Morel</b></sub></a><br /><a href="https://github.com/jimp-dev/jimp/commits?author=Marsup" title="Code">💻</a></td>
311311
<td align="center"><a href="https://github.com/stevezac-osu"><img src="https://avatars.githubusercontent.com/u/71655313?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Zach Stevenson</b></sub></a><br /><a href="https://github.com/jimp-dev/jimp/commits?author=stevezac-osu" title="Code">💻</a></td>
312+
<td align="center"><a href="https://github.com/AnotherPillow"><img src="https://avatars.githubusercontent.com/u/85362273?v=4?s=100" width="100px;" alt=""/><br /><sub><b>AnotherPillow</b></sub></a><br /><a href="https://github.com/jimp-dev/jimp/commits?author=AnotherPillow" title="Documentation">📖</a></td>
312313
</tr>
313314
</table>
314315

lerna.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"lerna": "2.11.0",
2+
"lerna": "^7.1.4",
33
"npmClient": "yarn",
44
"registry": "https://registry.npmjs.org/",
5-
"useWorkspaces": true,
6-
"version": "0.22.10"
5+
"version": "0.22.11",
6+
"packages": ["packages/*"]
77
}

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
"postinstall": "patch-package"
2828
},
2929
"devDependencies": {
30-
"@auto-it/all-contributors": "^10.38.4",
31-
"@auto-it/first-time-contributor": "^10.38.4",
32-
"@auto-it/magic-zero": "^10.38.4",
33-
"@auto-it/protected-branch": "^10.38.4",
30+
"@auto-it/all-contributors": "^11.0.5",
31+
"@auto-it/first-time-contributor": "^11.0.5",
32+
"@auto-it/magic-zero": "^11.0.5",
33+
"@auto-it/protected-branch": "^11.0.5",
3434
"@babel/cli": "^7.20.7",
3535
"@babel/core": "^7.20.12",
3636
"@babel/preset-env": "^7.20.2",
@@ -40,7 +40,7 @@
4040
"@typescript-eslint/eslint-plugin": "^5.50.0",
4141
"@typescript-eslint/parser": "^5.50.0",
4242
"all-contributors-cli": "^6.24.0",
43-
"auto": "^10.38.4",
43+
"auto": "^11.0.5",
4444
"babel-plugin-add-module-exports": "^1.0.4",
4545
"babel-plugin-source-map-support": "^2.2.0",
4646
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
@@ -59,7 +59,7 @@
5959
"karma-firefox-launcher": "^1.2.0",
6060
"karma-mocha": "^1.3.0",
6161
"karma-mocha-reporter": "^2.2.5",
62-
"lerna": "^3.16.4",
62+
"lerna": "^7.1.4",
6363
"lint-staged": "^9.2.5",
6464
"mocha": "^6.2.0",
6565
"nyc": "^14.1.1",

packages/core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/core",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "Jimp core",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/core/src/index.js

+14-24
Original file line numberDiff line numberDiff line change
@@ -739,10 +739,6 @@ class Jimp extends EventEmitter {
739739
if (typeof x !== "number" || typeof y !== "number")
740740
return throwError.call(this, "x and y must be numbers", cb);
741741

742-
// round input
743-
x = Math.round(x);
744-
y = Math.round(y);
745-
746742
const idx = this.getPixelIndex(x, y);
747743
const hex = this.bitmap.data.readUInt32BE(idx);
748744

@@ -771,10 +767,6 @@ class Jimp extends EventEmitter {
771767
)
772768
return throwError.call(this, "hex, x and y must be numbers", cb);
773769

774-
// round input
775-
x = Math.round(x);
776-
y = Math.round(y);
777-
778770
const idx = this.getPixelIndex(x, y);
779771
this.bitmap.data.writeUInt32BE(hex, idx);
780772

@@ -792,14 +784,12 @@ class Jimp extends EventEmitter {
792784
* @return {boolean} hasAlpha whether the image contains opaque pixels
793785
*/
794786
hasAlpha() {
795-
for (let yIndex = 0; yIndex < this.bitmap.height; yIndex++) {
796-
for (let xIndex = 0; xIndex < this.bitmap.width; xIndex++) {
797-
const idx = (this.bitmap.width * yIndex + xIndex) << 2;
798-
const alpha = this.bitmap.data[idx + 3];
787+
const { width, height, data } = this.bitmap;
788+
const byteLen = (width * height) << 2;
799789

800-
if (alpha !== 0xff) {
801-
return true;
802-
}
790+
for (let idx = 3; idx < byteLen; idx += 4) {
791+
if (data[idx] !== 0xff) {
792+
return true;
803793
}
804794
}
805795

@@ -905,16 +895,16 @@ Jimp.rgbaToInt = function (r, g, b, a, cb) {
905895
return throwError.call(this, "a must be between 0 and 255", cb);
906896
}
907897

908-
r = Math.round(r);
909-
b = Math.round(b);
910-
g = Math.round(g);
911-
a = Math.round(a);
898+
let i = r & 0xff;
899+
i <<= 8;
900+
i |= g & 0xff;
901+
i <<= 8;
902+
i |= b & 0xff;
903+
i <<= 8;
904+
i |= a & 0xff;
912905

913-
const i =
914-
r * Math.pow(256, 3) +
915-
g * Math.pow(256, 2) +
916-
b * Math.pow(256, 1) +
917-
a * Math.pow(256, 0);
906+
// Ensure sign is correct
907+
i >>>= 0;
918908

919909
if (isNodePattern(cb)) {
920910
cb.call(this, null, i);

packages/core/src/modules/phash.js

+12-17
Original file line numberDiff line numberDiff line change
@@ -125,24 +125,19 @@ ImagePHash.prototype.getHash = function (img) {
125125

126126
// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java
127127

128+
/**
129+
Convert a 32-bit integer color value to an RGBA object.
130+
*/
128131
function intToRGBA(i) {
129-
const rgba = {};
130-
131-
rgba.r = Math.floor(i / Math.pow(256, 3));
132-
rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));
133-
rgba.b = Math.floor(
134-
(i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /
135-
Math.pow(256, 1)
136-
);
137-
rgba.a = Math.floor(
138-
(i -
139-
rgba.r * Math.pow(256, 3) -
140-
rgba.g * Math.pow(256, 2) -
141-
rgba.b * Math.pow(256, 1)) /
142-
Math.pow(256, 0)
143-
);
144-
145-
return rgba;
132+
const a = i & 0xff;
133+
i >>>= 8;
134+
const b = i & 0xff;
135+
i >>>= 8;
136+
const g = i & 0xff;
137+
i >>>= 8;
138+
const r = i & 0xff;
139+
140+
return { r, g, b, a };
146141
}
147142

148143
const c = [];

packages/custom/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/custom",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "Interface to customize jimp configuration",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/jimp/CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
# v0.22.11 (Fri Feb 23 2024)
2+
3+
:tada: This release contains work from a new contributor! :tada:
4+
5+
Thank you, null[@AnotherPillow](https://github.com/AnotherPillow), for all your work!
6+
7+
#### 📝 Documentation
8+
9+
- Fix it's/its, see description. [#1267](https://github.com/jimp-dev/jimp/pull/1267) ([@AnotherPillow](https://github.com/AnotherPillow))
10+
11+
#### Authors: 1
12+
13+
- [@AnotherPillow](https://github.com/AnotherPillow)
14+
15+
---
16+
117
# v0.22.9 (Wed Jul 26 2023)
218

319
:tada: This release contains work from a new contributor! :tada:

packages/jimp/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jimp",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "An image processing library written entirely in JavaScript (i.e. zero external or native dependencies)",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-blit/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-blit",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "Blit an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-blur/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-blur",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "blur an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-circle/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-circle",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "Creates a circle out of an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-color/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-color",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "Bitmap manipulation to adjust the color in an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-contain/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-contain",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "contain an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-cover/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-cover",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "cover an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-crop/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-crop",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "crop an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-displace/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-displace",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "displace an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-dither/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-dither",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "Dither an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-fisheye/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-fisheye",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "Apply a fisheye effect to an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-flip/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-flip",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "flip an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-gaussian/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-gaussian",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "gaussian blur an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-invert/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-invert",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "invert an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-mask/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-mask",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "mask an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

packages/plugin-normalize/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jimp/plugin-normalize",
3-
"version": "0.22.10",
3+
"version": "0.22.11",
44
"description": "normalize an image.",
55
"main": "dist/index.js",
66
"module": "es/index.js",

0 commit comments

Comments
 (0)