chore: add jimp dependency, icon padding script, and update configuration
This commit is contained in:
+85
@@ -0,0 +1,85 @@
|
||||
# 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.22.0 (Mon Feb 06 2023)
|
||||
|
||||
#### 🏠 Internal
|
||||
|
||||
- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes))
|
||||
|
||||
#### Authors: 2
|
||||
|
||||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
- Daniel Holmes ([@danielholmes](https://github.com/danielholmes))
|
||||
|
||||
---
|
||||
|
||||
# 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.
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<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/bmp</h1>
|
||||
<p>Default Jimp bmp encoder/decoder.</p>
|
||||
</div>
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
import BMP from "bmp-js";
|
||||
import { scan } from "@jimp/utils";
|
||||
const MIME_TYPE = "image/bmp";
|
||||
const MIME_TYPE_SECOND = "image/x-ms-bmp";
|
||||
function toAGBR(image) {
|
||||
return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function (x, y, index) {
|
||||
const red = this.bitmap.data[index + 0];
|
||||
const green = this.bitmap.data[index + 1];
|
||||
const blue = this.bitmap.data[index + 2];
|
||||
const alpha = this.bitmap.data[index + 3];
|
||||
this.bitmap.data[index + 0] = alpha;
|
||||
this.bitmap.data[index + 1] = blue;
|
||||
this.bitmap.data[index + 2] = green;
|
||||
this.bitmap.data[index + 3] = red;
|
||||
}).bitmap;
|
||||
}
|
||||
function fromAGBR(bitmap) {
|
||||
return scan({
|
||||
bitmap
|
||||
}, 0, 0, bitmap.width, bitmap.height, function (x, y, index) {
|
||||
const alpha = this.bitmap.data[index + 0];
|
||||
const blue = this.bitmap.data[index + 1];
|
||||
const green = this.bitmap.data[index + 2];
|
||||
const red = this.bitmap.data[index + 3];
|
||||
this.bitmap.data[index + 0] = red;
|
||||
this.bitmap.data[index + 1] = green;
|
||||
this.bitmap.data[index + 2] = blue;
|
||||
this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;
|
||||
}).bitmap;
|
||||
}
|
||||
const decode = data => fromAGBR(BMP.decode(data));
|
||||
const encode = image => BMP.encode(toAGBR(image)).data;
|
||||
export default (() => ({
|
||||
mime: {
|
||||
[MIME_TYPE]: ["bmp"]
|
||||
},
|
||||
constants: {
|
||||
MIME_BMP: MIME_TYPE,
|
||||
MIME_X_MS_BMP: MIME_TYPE_SECOND
|
||||
},
|
||||
decoders: {
|
||||
[MIME_TYPE]: decode,
|
||||
[MIME_TYPE_SECOND]: decode
|
||||
},
|
||||
encoders: {
|
||||
[MIME_TYPE]: encode,
|
||||
[MIME_TYPE_SECOND]: encode
|
||||
}
|
||||
}));
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","names":["BMP","scan","MIME_TYPE","MIME_TYPE_SECOND","toAGBR","image","bitmap","width","height","x","y","index","red","data","green","blue","alpha","fromAGBR","is_with_alpha","decode","encode","mime","constants","MIME_BMP","MIME_X_MS_BMP","decoders","encoders"],"sources":["../src/index.js"],"sourcesContent":["import BMP from \"bmp-js\";\nimport { scan } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/bmp\";\nconst MIME_TYPE_SECOND = \"image/x-ms-bmp\";\n\nfunction toAGBR(image) {\n return scan(\n image,\n 0,\n 0,\n image.bitmap.width,\n image.bitmap.height,\n function (x, y, index) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }\n ).bitmap;\n}\n\nfunction fromAGBR(bitmap) {\n return scan(\n { bitmap },\n 0,\n 0,\n bitmap.width,\n bitmap.height,\n function (x, y, index) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }\n ).bitmap;\n}\n\nconst decode = (data) => fromAGBR(BMP.decode(data));\nconst encode = (image) => BMP.encode(toAGBR(image)).data;\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"bmp\"] },\n\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND,\n },\n\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode,\n },\n\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode,\n },\n});\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,QAAQ;AACxB,SAASC,IAAI,QAAQ,aAAa;AAElC,MAAMC,SAAS,GAAG,WAAW;AAC7B,MAAMC,gBAAgB,GAAG,gBAAgB;AAEzC,SAASC,MAAM,CAACC,KAAK,EAAE;EACrB,OAAOJ,IAAI,CACTI,KAAK,EACL,CAAC,EACD,CAAC,EACDA,KAAK,CAACC,MAAM,CAACC,KAAK,EAClBF,KAAK,C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MAAMC,GAAG,GAAG,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC;IAEvC,IAAI,CAACL,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC,GAAGC,GAAG;IACjC,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC,GAAGG,KAAK;IACnC,IAAI,CAACR,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC,GAAGI,IAAI;IAClC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC,GAAGL,MAAM,CAACY,aAAa,GAAGF,KAAK,GAAG,IAAI;EACnE,CAAC,CACF,CAACV,MAAM;AACV;AAEA,MAAMa,MAAM,GAAIN,IAAI,IAAKI,QAAQ,CAACjB,GAAG,CAACmB,MAAM,CAACN,IAAI,CAAC,CAAC;AACnD,MAAMO,MAAM,GAAIf,KAAK,IAAKL,GAAG,CAACoB,MAAM,CAAChB,MAAM,CAACC,KAAK,CAAC,CAAC,CAACQ,IAAI;AAExD,gBAAe,OAAO;EACpBQ,IAAI,EAAE;IAAE,CAACnB,SAAS,GAAG,CAAC,KAAK;EAAE,CAAC;EAE9BoB,SAAS,EAAE;IACTC,QAAQ,EAAErB,SAAS;IACnBsB,aAAa,EAAErB;EACjB,CAAC;EAEDsB,QAAQ,EAAE;IACR,CAACvB,SAAS,GAAGiB,MAAM;IACnB,CAAChB,gBAAgB,GAAGgB;EACtB,CAAC;EAEDO,QAAQ,EAAE;IACR,CAACxB,SAAS,GAAGkB,MAAM;IACnB,CAACjB,gBAAgB,GAAGiB;EACtB;AACF,CAAC,CAAC"}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import { DecoderFn, EncoderFn } from "@jimp/core";
|
||||
|
||||
interface Bmp {
|
||||
constants: {
|
||||
MIME_BMP: "image/bmp";
|
||||
MIME_X_MS_BMP: "image/x-ms-bmp";
|
||||
};
|
||||
|
||||
mime: {
|
||||
"image/bmp": string[];
|
||||
};
|
||||
|
||||
decoders: {
|
||||
"image/bmp": DecoderFn;
|
||||
"image/x-ms-bmp": DecoderFn;
|
||||
};
|
||||
|
||||
encoders: {
|
||||
"image/bmp": EncoderFn;
|
||||
"image/x-ms-bmp": EncoderFn;
|
||||
};
|
||||
}
|
||||
|
||||
export default function (): Bmp;
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "@jimp/bmp",
|
||||
"version": "0.22.12",
|
||||
"description": "Default Jimp bmp encoder/decoder.",
|
||||
"main": "dist/index.js",
|
||||
"module": "es/index.js",
|
||||
"repository": "jimp-dev/jimp",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js",
|
||||
"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": {
|
||||
"@jimp/utils": "^0.22.12",
|
||||
"bmp-js": "^0.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@jimp/custom": ">=0.3.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jimp/custom": "^0.22.12",
|
||||
"@jimp/test-utils": "^0.22.12"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc"
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
import BMP from "bmp-js";
|
||||
import { scan } from "@jimp/utils";
|
||||
|
||||
const MIME_TYPE = "image/bmp";
|
||||
const MIME_TYPE_SECOND = "image/x-ms-bmp";
|
||||
|
||||
function toAGBR(image) {
|
||||
return scan(
|
||||
image,
|
||||
0,
|
||||
0,
|
||||
image.bitmap.width,
|
||||
image.bitmap.height,
|
||||
function (x, y, index) {
|
||||
const red = this.bitmap.data[index + 0];
|
||||
const green = this.bitmap.data[index + 1];
|
||||
const blue = this.bitmap.data[index + 2];
|
||||
const alpha = this.bitmap.data[index + 3];
|
||||
|
||||
this.bitmap.data[index + 0] = alpha;
|
||||
this.bitmap.data[index + 1] = blue;
|
||||
this.bitmap.data[index + 2] = green;
|
||||
this.bitmap.data[index + 3] = red;
|
||||
}
|
||||
).bitmap;
|
||||
}
|
||||
|
||||
function fromAGBR(bitmap) {
|
||||
return scan(
|
||||
{ bitmap },
|
||||
0,
|
||||
0,
|
||||
bitmap.width,
|
||||
bitmap.height,
|
||||
function (x, y, index) {
|
||||
const alpha = this.bitmap.data[index + 0];
|
||||
const blue = this.bitmap.data[index + 1];
|
||||
const green = this.bitmap.data[index + 2];
|
||||
const red = this.bitmap.data[index + 3];
|
||||
|
||||
this.bitmap.data[index + 0] = red;
|
||||
this.bitmap.data[index + 1] = green;
|
||||
this.bitmap.data[index + 2] = blue;
|
||||
this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;
|
||||
}
|
||||
).bitmap;
|
||||
}
|
||||
|
||||
const decode = (data) => fromAGBR(BMP.decode(data));
|
||||
const encode = (image) => BMP.encode(toAGBR(image)).data;
|
||||
|
||||
export default () => ({
|
||||
mime: { [MIME_TYPE]: ["bmp"] },
|
||||
|
||||
constants: {
|
||||
MIME_BMP: MIME_TYPE,
|
||||
MIME_X_MS_BMP: MIME_TYPE_SECOND,
|
||||
},
|
||||
|
||||
decoders: {
|
||||
[MIME_TYPE]: decode,
|
||||
[MIME_TYPE_SECOND]: decode,
|
||||
},
|
||||
|
||||
encoders: {
|
||||
[MIME_TYPE]: encode,
|
||||
[MIME_TYPE_SECOND]: encode,
|
||||
},
|
||||
});
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
import { Jimp, getTestDir } from "@jimp/test-utils";
|
||||
import configure from "@jimp/custom";
|
||||
import expect from "@storybook/expect";
|
||||
|
||||
import bmp from "../src";
|
||||
|
||||
const jimp = configure({ types: [bmp] }, Jimp);
|
||||
|
||||
describe("BMP", () => {
|
||||
const imagesDir = getTestDir(__dirname) + "/images";
|
||||
|
||||
it("load BMP", async () => {
|
||||
const image = await jimp.read(imagesDir + "/windows95.bmp");
|
||||
|
||||
expect(image.getPixelColor(10, 10)).toBe(0xeff7f7ff);
|
||||
expect(image.getPixelColor(150, 80)).toBe(0x73add6ff);
|
||||
expect(image.getPixelColor(190, 200)).toBe(0xf7c300ff);
|
||||
});
|
||||
|
||||
it("export BMP", async () => {
|
||||
const image = await jimp.read({
|
||||
width: 3,
|
||||
height: 3,
|
||||
data: [
|
||||
0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff,
|
||||
0xff00ffff, 0x8000ffff, 0x0000ffff,
|
||||
],
|
||||
});
|
||||
const buffer = await image.getBufferAsync("image/bmp");
|
||||
|
||||
expect(buffer.toString()).toMatch(/^BMZ\u0000/);
|
||||
});
|
||||
|
||||
it("uses correct colors for BMP", async function () {
|
||||
this.timeout(4000);
|
||||
|
||||
const expectedImg = await jimp.read(
|
||||
getTestDir(__dirname) + "/images/windows95.png"
|
||||
);
|
||||
const image = await jimp.read(
|
||||
getTestDir(__dirname) + "/images/windows95.bmp"
|
||||
);
|
||||
|
||||
expect(image.bitmap.data).toEqual(expectedImg.bitmap.data);
|
||||
});
|
||||
});
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 126 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 111 KiB |
Reference in New Issue
Block a user