Initial commit
This commit is contained in:
commit
e49726988c
5445 files changed
+1089914
No files matched your search
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "../src",
|
||||
"module": "nodenext",
|
||||
"moduleResolution": "nodenext"
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "./build.json",
|
||||
"include": [
|
||||
"../src/**/*.ts",
|
||||
"../src/**/*.cts",
|
||||
"../src/**/*.tsx",
|
||||
"../src/**/*.json"
|
||||
],
|
||||
"exclude": [
|
||||
"../**/*.test.ts",
|
||||
"../src/**/*.mts",
|
||||
"../src/package.json"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"outDir": "../.tshy-build/commonjs"
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"extends": "./build.json",
|
||||
"include": [
|
||||
"../src/**/*.ts",
|
||||
"../src/**/*.mts",
|
||||
"../src/**/*.tsx",
|
||||
"../src/**/*.json"
|
||||
],
|
||||
"exclude": [
|
||||
"../**/*.test.ts",
|
||||
"../src/package.json"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"outDir": "../.tshy-build/esm"
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
> @jimp/js-jpeg@1.5.0 build /Users/andrewlisowski/Documents/jimp/plugins/js-jpeg
|
||||
> tshy
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
> @jimp/js-jpeg@1.1.2 lint /Users/andrewlisowski/Documents/jimp/plugins/js-jpeg
|
||||
> eslint .
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
|
||||
|
||||
> @jimp/js-jpeg@1.1.2 test:browser /Users/andrewlisowski/Documents/jimp/plugins/js-jpeg
|
||||
> vitest --config vitest.config.browser.mjs "--watch=false"
|
||||
|
||||
Re-optimizing dependencies because lockfile has changed
|
||||
Port 5173 is in use, trying another one...
|
||||
|
||||
[7m[1m[36m RUN [39m[22m[27m [36mv2.0.5[39m [90m/Users/andrewlisowski/Documents/jimp/plugins/js-jpeg[39m
|
||||
[2m[32m Browser runner started at http://localhost:5174/[39m[22m
|
||||
|
||||
[2m1:39:22 AM[22m [36m[1m[vite][22m[39m [32m✨ new dependencies optimized: [33mvite-plugin-node-polyfills/shims/buffer, vite-plugin-node-polyfills/shims/global, vite-plugin-node-polyfills/shims/process, path[32m[39m
|
||||
[2m1:39:22 AM[22m [36m[1m[vite][22m[39m [32m✨ optimized dependencies changed. reloading[39m
|
||||
[?25l [90m·[39m [2msrc/[22mindex[2m.test.ts[22m[2m (3)[22m
|
||||
[90m·[39m JPEG[2m (3)[22m
|
||||
[90m·[39m load JPG
|
||||
[90m·[39m load JPG with fill bytes
|
||||
[90m·[39m export JPG
|
||||
[?25l[?25l[?25l[?25l[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G [32m✓[39m [2msrc/[22mindex[2m.test.ts[22m[2m (3)[22m
|
||||
[32m✓[39m JPEG[2m (3)[22m
|
||||
[32m✓[39m load JPG
|
||||
[32m✓[39m load JPG with fill bytes
|
||||
[32m✓[39m export JPG
|
||||
[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G [32m✓[39m [2msrc/[22mindex[2m.test.ts[22m[2m (3)[22m
|
||||
[32m✓[39m JPEG[2m (3)[22m
|
||||
[32m✓[39m load JPG
|
||||
[32m✓[39m load JPG with fill bytes
|
||||
[32m✓[39m export JPG
|
||||
|
||||
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
||||
[2m Tests [22m [1m[32m3 passed[39m[22m[90m (3)[39m
|
||||
[2m Start at [22m 01:39:12
|
||||
[2m Duration [22m 12.42s[2m (transform 0ms, setup 0ms, collect 198ms, tests 92ms, environment 0ms, prepare 1.69s)[22m
|
||||
|
||||
[?25h[?25h
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
> @jimp/js-jpeg@1.1.2 test /Users/andrewlisowski/Documents/jimp/plugins/js-jpeg
|
||||
> vitest "--watch=false"
|
||||
|
||||
|
||||
[7m[1m[36m RUN [39m[22m[27m [36mv2.0.5[39m [90m/Users/andrewlisowski/Documents/jimp/plugins/js-jpeg[39m
|
||||
|
||||
[?25l [90m·[39m [2msrc/[22mindex[2m.test.ts[22m[2m (3)[22m
|
||||
[90m·[39m JPEG[2m (3)[22m
|
||||
[90m·[39m load JPG
|
||||
[90m·[39m load JPG with fill bytes
|
||||
[90m·[39m export JPG
|
||||
[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[?25l[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G [32m✓[39m [2msrc/[22mindex[2m.test.ts[22m[2m (3)[22m[33m 340[2mms[22m[39m
|
||||
[32m✓[39m JPEG[2m (3)[22m[33m 339[2mms[22m[39m
|
||||
[32m✓[39m load JPG
|
||||
[32m✓[39m load JPG with fill bytes
|
||||
[32m✓[39m export JPG
|
||||
[?25l[2K[1A[2K[1A[2K[1A[2K[1A[2K[1A[2K[G [32m✓[39m [2msrc/[22mindex[2m.test.ts[22m[2m (3)[22m[33m 340[2mms[22m[39m
|
||||
[32m✓[39m JPEG[2m (3)[22m[33m 339[2mms[22m[39m
|
||||
[32m✓[39m load JPG
|
||||
[32m✓[39m load JPG with fill bytes
|
||||
[32m✓[39m export JPG
|
||||
|
||||
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
||||
[2m Tests [22m [1m[32m3 passed[39m[22m[90m (3)[39m
|
||||
[2m Start at [22m 01:33:45
|
||||
[2m Duration [22m 2.48s[2m (transform 377ms, setup 0ms, collect 729ms, tests 340ms, environment 0ms, prepare 540ms)[22m
|
||||
|
||||
[?25h[?25h
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
# v1.5.0 (Sat Sep 07 2024)
|
||||
|
||||
### Release Notes
|
||||
|
||||
#### Add support for image decoder options ([#1336](https://github.com/jimp-dev/jimp/pull/1336))
|
||||
|
||||
Can now have options for the underlying image codecs
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
#### 🚀 Enhancement
|
||||
|
||||
- Add support for image decoder options [#1336](https://github.com/jimp-dev/jimp/pull/1336) ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
---
|
||||
|
||||
# v1.1.3 (Mon Sep 02 2024)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- Update deps [#1319](https://github.com/jimp-dev/jimp/pull/1319) ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
---
|
||||
|
||||
# v1.1.0 (Sun Sep 01 2024)
|
||||
|
||||
#### ⚠️ Pushed to `main`
|
||||
|
||||
- upgrade tshy ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
- update more docs ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
---
|
||||
|
||||
# v1.0.3 (Sat Aug 31 2024)
|
||||
|
||||
#### 🐛 Bug Fix
|
||||
|
||||
- Fix build [#1303](https://github.com/jimp-dev/jimp/pull/1303) ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
#### ⚠️ Pushed to `main`
|
||||
|
||||
- add clean script ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
---
|
||||
|
||||
# v1.0.2 (Sat Aug 31 2024)
|
||||
|
||||
#### ⚠️ Pushed to `main`
|
||||
|
||||
- set side effects ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
- fix versions ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
- add publish config ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
|
||||
#### Authors: 1
|
||||
|
||||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie))
|
||||
+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/jpeg</h1>
|
||||
<p>Default Jimp jpeg encoder/decoder.</p>
|
||||
</div>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import JPEG from "jpeg-js";
|
||||
export interface JPEGOptions {
|
||||
quality?: number;
|
||||
}
|
||||
export interface DecodeJpegOptions {
|
||||
useTArray?: false;
|
||||
colorTransform?: boolean;
|
||||
formatAsRGBA?: boolean;
|
||||
tolerantDecoding?: boolean;
|
||||
maxResolutionInMP?: number;
|
||||
maxMemoryUsageInMB?: number;
|
||||
}
|
||||
export default function jpeg(): {
|
||||
mime: "image/jpeg";
|
||||
encode: (bitmap: import("@jimp/types").Bitmap, { quality }?: JPEGOptions) => Buffer;
|
||||
decode: (data: Buffer, options?: DecodeJpegOptions) => JPEG.BufferRet & {
|
||||
comments?: string[];
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAG3B,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,CAAC,OAAO,UAAU,IAAI;;iEAGY,WAAW;qCAEtB,iBAAiB;;;EAE7C"}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = jpeg;
|
||||
const jpeg_js_1 = __importDefault(require("jpeg-js"));
|
||||
function jpeg() {
|
||||
return {
|
||||
mime: "image/jpeg",
|
||||
encode: (bitmap, { quality = 100 } = {}) => jpeg_js_1.default.encode(bitmap, quality).data,
|
||||
decode: (data, options) => jpeg_js_1.default.decode(data, options),
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AAgBA,uBAOC;AAvBD,sDAA2B;AAgB3B,SAAwB,IAAI;IAC1B,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,OAAO,GAAG,GAAG,KAAkB,EAAE,EAAE,EAAE,CACtD,iBAAI,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI;QACnC,MAAM,EAAE,CAAC,IAAI,EAAE,OAA2B,EAAE,EAAE,CAAC,iBAAI,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;KAC3C,CAAC;AACnC,CAAC"}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import JPEG from "jpeg-js";
|
||||
export interface JPEGOptions {
|
||||
quality?: number;
|
||||
}
|
||||
export interface DecodeJpegOptions {
|
||||
useTArray?: false;
|
||||
colorTransform?: boolean;
|
||||
formatAsRGBA?: boolean;
|
||||
tolerantDecoding?: boolean;
|
||||
maxResolutionInMP?: number;
|
||||
maxMemoryUsageInMB?: number;
|
||||
}
|
||||
export default function jpeg(): {
|
||||
mime: "image/jpeg";
|
||||
encode: (bitmap: import("@jimp/types").Bitmap, { quality }?: JPEGOptions) => Buffer;
|
||||
decode: (data: Buffer, options?: DecodeJpegOptions) => JPEG.BufferRet & {
|
||||
comments?: string[];
|
||||
};
|
||||
};
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAG3B,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,CAAC,OAAO,UAAU,IAAI;;iEAGY,WAAW;qCAEtB,iBAAiB;;;EAE7C"}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import JPEG from "jpeg-js";
|
||||
export default function jpeg() {
|
||||
return {
|
||||
mime: "image/jpeg",
|
||||
encode: (bitmap, { quality = 100 } = {}) => JPEG.encode(bitmap, quality).data,
|
||||
decode: (data, options) => JPEG.decode(data, options),
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAgB3B,MAAM,CAAC,OAAO,UAAU,IAAI;IAC1B,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,OAAO,GAAG,GAAG,KAAkB,EAAE,EAAE,EAAE,CACtD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI;QACnC,MAAM,EAAE,CAAC,IAAI,EAAE,OAA2B,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;KAC3C,CAAC;AACnC,CAAC"}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import shared from "@jimp/config-eslint/base.js";
|
||||
export default [...shared];
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"name": "@jimp/js-jpeg",
|
||||
"version": "1.6.0",
|
||||
"repository": "jimp-dev/jimp",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "vitest",
|
||||
"test:browser": "vitest --config vitest.config.browser.mjs",
|
||||
"build": "tshy",
|
||||
"dev": "tshy --watch",
|
||||
"clean": "rm -rf node_modules .tshy .tshy-build dist .turbo"
|
||||
},
|
||||
"author": "Andrew Lisowski <lisowski54@gmail.com>",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@jimp/config-eslint": "1.6.0",
|
||||
"@jimp/config-typescript": "1.6.0",
|
||||
"@jimp/config-vitest": "1.6.0",
|
||||
"@jimp/test-utils": "1.6.0",
|
||||
"@vitest/browser": "^2.0.5",
|
||||
"eslint": "^9.9.1",
|
||||
"tshy": "^3.0.2",
|
||||
"typescript": "^5.5.4",
|
||||
"vite-plugin-node-polyfills": "^0.22.0",
|
||||
"vitest": "^2.0.5"
|
||||
},
|
||||
"tshy": {
|
||||
"exclude": [
|
||||
"**/*.test.ts"
|
||||
],
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"main": "./dist/commonjs/index.js",
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@jimp/core": "1.6.0",
|
||||
"@jimp/types": "1.6.0",
|
||||
"jpeg-js": "^0.4.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"module": "./dist/esm/index.js",
|
||||
"gitHead": "c88abe6046dccbdb6e4f5f00c3dd403c81d83515"
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
import { expect, test, describe } from "vitest";
|
||||
import { createJimp } from "@jimp/core";
|
||||
import { getTestImagePath } from "@jimp/test-utils";
|
||||
|
||||
import jpeg from "./index.js";
|
||||
|
||||
const jimp = createJimp({ formats: [jpeg] });
|
||||
|
||||
describe("JPEG", () => {
|
||||
test("load JPG", async () => {
|
||||
const image = await jimp.read(getTestImagePath("cops.jpg"));
|
||||
|
||||
expect(image.getPixelColor(10, 10)).toBe(0x3f4a02ff);
|
||||
expect(image.getPixelColor(220, 190)).toBe(0x5d94b6ff);
|
||||
expect(image.getPixelColor(350, 130)).toBe(0xdf7944ff);
|
||||
});
|
||||
|
||||
test("load JPG with fill bytes", async () => {
|
||||
const image = await jimp.read(getTestImagePath("fillbytes.jpg"));
|
||||
|
||||
expect(image.getPixelColor(10, 10)).toBe(0xaeb8c3ff);
|
||||
expect(image.getPixelColor(220, 190)).toBe(0x262b21ff);
|
||||
expect(image.getPixelColor(350, 130)).toBe(0x4e5d30ff);
|
||||
});
|
||||
|
||||
test("export JPG", async () => {
|
||||
const image = jimp.fromBitmap({
|
||||
width: 3,
|
||||
height: 3,
|
||||
data: [
|
||||
0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff,
|
||||
0xff00ffff, 0x8000ffff, 0x0000ffff,
|
||||
],
|
||||
});
|
||||
|
||||
const buffer = await image.getBuffer("image/jpeg", {
|
||||
quality: 50,
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-control-regex
|
||||
expect(buffer.toString()).toMatch(/^.{3,9}JFIF\u0000/);
|
||||
});
|
||||
});
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
import JPEG from "jpeg-js";
|
||||
import { Format } from "@jimp/types";
|
||||
|
||||
export interface JPEGOptions {
|
||||
quality?: number;
|
||||
}
|
||||
|
||||
export interface DecodeJpegOptions {
|
||||
useTArray?: false;
|
||||
colorTransform?: boolean;
|
||||
formatAsRGBA?: boolean;
|
||||
tolerantDecoding?: boolean;
|
||||
maxResolutionInMP?: number;
|
||||
maxMemoryUsageInMB?: number;
|
||||
}
|
||||
|
||||
export default function jpeg() {
|
||||
return {
|
||||
mime: "image/jpeg",
|
||||
encode: (bitmap, { quality = 100 }: JPEGOptions = {}) =>
|
||||
JPEG.encode(bitmap, quality).data,
|
||||
decode: (data, options?: DecodeJpegOptions) => JPEG.decode(data, options),
|
||||
} satisfies Format<"image/jpeg">;
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "@jimp/config-typescript/base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist"
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import config from "@jimp/config-vitest/browser";
|
||||
|
||||
export default config;
|
||||
Reference in new issue
Block a user