@blazetrails/image-processing 0.0.0-stage → 0.1.0-alpha0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/builder.d.ts +17 -0
- package/dist/builder.js +36 -0
- package/dist/builder.js.map +1 -0
- package/dist/chainable.d.ts +49 -0
- package/dist/chainable.js +121 -0
- package/dist/chainable.js.map +1 -0
- package/dist/constants.generated.d.ts +2 -0
- package/dist/constants.generated.js +14 -0
- package/dist/constants.generated.js.map +1 -0
- package/dist/image-processing.d.ts +11 -0
- package/dist/image-processing.js +12 -0
- package/dist/image-processing.js.map +1 -0
- package/dist/mini-magick.d.ts +56 -0
- package/dist/mini-magick.js +240 -0
- package/dist/mini-magick.js.map +1 -0
- package/dist/namespaces.d.ts +18 -0
- package/dist/namespaces.js +14 -0
- package/dist/namespaces.js.map +1 -0
- package/dist/pipeline.d.ts +38 -0
- package/dist/pipeline.js +121 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/processor.d.ts +25 -0
- package/dist/processor.js +80 -0
- package/dist/processor.js.map +1 -0
- package/dist/vips.d.ts +66 -0
- package/dist/vips.js +455 -0
- package/dist/vips.js.map +1 -0
- package/package.json +62 -3
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dean Marano and Trails contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Included } from "@blazetrails/ruby-compat";
|
|
2
|
+
import { Chainable, type Options } from "./chainable.js";
|
|
3
|
+
export interface Builder extends Included<typeof Chainable> {
|
|
4
|
+
[operation: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
export declare class Builder {
|
|
7
|
+
readonly options: Options;
|
|
8
|
+
constructor(options: Options);
|
|
9
|
+
callBang(callOptions?: {
|
|
10
|
+
save?: boolean;
|
|
11
|
+
}): Promise<unknown>;
|
|
12
|
+
/** @internal */
|
|
13
|
+
private instrument;
|
|
14
|
+
/** @internal */
|
|
15
|
+
private pipelineOptions;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=builder.d.ts.map
|
package/dist/builder.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { include } from "@blazetrails/ruby-compat";
|
|
2
|
+
import { Chainable, chainableProxy } from "./chainable.js";
|
|
3
|
+
import { ImageProcessing } from "./namespaces.js";
|
|
4
|
+
import { Pipeline } from "./pipeline.js";
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
6
|
+
export class Builder {
|
|
7
|
+
options;
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.options = options;
|
|
10
|
+
}
|
|
11
|
+
callBang(callOptions = {}) {
|
|
12
|
+
return this.instrument(() => new Pipeline(this.pipelineOptions()).call(callOptions));
|
|
13
|
+
}
|
|
14
|
+
/** @internal */
|
|
15
|
+
async instrument(block) {
|
|
16
|
+
if (!this.options.instrumenter)
|
|
17
|
+
return block();
|
|
18
|
+
let result = null;
|
|
19
|
+
let pending;
|
|
20
|
+
await this.options.instrumenter({ ...this.pipelineOptions() }, () => {
|
|
21
|
+
pending = block().then((value) => (result = value));
|
|
22
|
+
return pending;
|
|
23
|
+
});
|
|
24
|
+
await pending;
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
/** @internal */
|
|
28
|
+
pipelineOptions() {
|
|
29
|
+
const { instrumenter: _instrumenter, ...options } = this.options;
|
|
30
|
+
return options;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
include(Builder, Chainable);
|
|
34
|
+
chainableProxy(Builder.prototype);
|
|
35
|
+
ImageProcessing.Builder = Builder;
|
|
36
|
+
//# sourceMappingURL=builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../lib/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAgB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOzC,4EAA4E;AAC5E,MAAM,OAAO,OAAO;IACT,OAAO,CAAU;IAE1B,YAAY,OAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,QAAQ,CAAC,WAAW,GAAuB,EAAE;QAC3C,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACvF,CAAC;IAED,gBAAgB;IACR,KAAK,CAAC,UAAU,CAAC,KAA6B;QACpD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY;YAAE,OAAO,KAAK,EAAE,CAAC;QAE/C,IAAI,MAAM,GAAY,IAAI,CAAC;QAC3B,IAAI,OAAqC,CAAC;QAC1C,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,GAAG,IAAI,CAAC,eAAe,EAAE,EAAE,EAAE,GAAG,EAAE;YAClE,OAAO,GAAG,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC;YACpD,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,MAAM,OAAO,CAAC;QACd,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,gBAAgB;IACR,eAAe;QACrB,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACjE,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAED,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAC5B,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,eAAe,CAAC,OAAO,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Builder } from "./builder.js";
|
|
2
|
+
export type Operation = [string, unknown[]] | [string, unknown[], (...args: never[]) => unknown];
|
|
3
|
+
export interface Options {
|
|
4
|
+
source: unknown;
|
|
5
|
+
loader: Record<string, unknown>;
|
|
6
|
+
saver: Record<string, unknown>;
|
|
7
|
+
format: string | null;
|
|
8
|
+
operations: Operation[];
|
|
9
|
+
processor: unknown;
|
|
10
|
+
instrumenter?: (options: Record<string, unknown>, block: () => unknown) => unknown;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface ChainableHost {
|
|
14
|
+
Processor?: unknown;
|
|
15
|
+
source(file: unknown): Builder;
|
|
16
|
+
convert(format: string | null): Builder;
|
|
17
|
+
loader(options?: Record<string, unknown>): Builder;
|
|
18
|
+
saver(options?: Record<string, unknown>): Builder;
|
|
19
|
+
instrumenter(block: Options["instrumenter"]): Builder;
|
|
20
|
+
apply(operations: Record<string, unknown> | [string, unknown][]): ChainableHost;
|
|
21
|
+
operation(name: string, ...args: unknown[]): Builder;
|
|
22
|
+
call(file?: unknown, options?: {
|
|
23
|
+
destination?: string | null;
|
|
24
|
+
save?: boolean;
|
|
25
|
+
}): Promise<unknown>;
|
|
26
|
+
branch(newOptions?: Record<string, unknown>): Builder;
|
|
27
|
+
methodMissing(name: string, ...args: unknown[]): unknown;
|
|
28
|
+
[operation: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
export declare const Chainable: {
|
|
31
|
+
source(this: ChainableHost, file: unknown): Builder;
|
|
32
|
+
convert(this: ChainableHost, format: string | null): Builder;
|
|
33
|
+
loader(this: ChainableHost, options?: Record<string, unknown>): Builder;
|
|
34
|
+
saver(this: ChainableHost, options?: Record<string, unknown>): Builder;
|
|
35
|
+
instrumenter(this: ChainableHost, block: Options["instrumenter"]): Builder;
|
|
36
|
+
apply(this: ChainableHost, operations: Record<string, unknown> | [string, unknown][]): ChainableHost;
|
|
37
|
+
operation(this: ChainableHost, name: string, ...args: unknown[]): Builder;
|
|
38
|
+
call(this: ChainableHost, file?: unknown, { destination, ...callOptions }?: {
|
|
39
|
+
destination?: string | null;
|
|
40
|
+
save?: boolean;
|
|
41
|
+
}): Promise<unknown>;
|
|
42
|
+
branch(this: ChainableHost, newOptions?: Record<string, unknown>): Builder;
|
|
43
|
+
/** @internal */
|
|
44
|
+
methodMissing(this: ChainableHost, name: string, ...args: unknown[]): unknown;
|
|
45
|
+
};
|
|
46
|
+
export declare const DEFAULT_OPTIONS: Options;
|
|
47
|
+
/** @noRailsEquivalent PERMANENT */
|
|
48
|
+
export declare function chainableProxy(host: object): void;
|
|
49
|
+
//# sourceMappingURL=chainable.d.ts.map
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { isPlainHash, NoMethodError, PROTOCOL_PROBES, rbBlockGivenP, rbFSend, } from "@blazetrails/ruby-compat";
|
|
2
|
+
import { ImageProcessing } from "./namespaces.js";
|
|
3
|
+
export const Chainable = {
|
|
4
|
+
source(file) {
|
|
5
|
+
return this.branch({ source: file });
|
|
6
|
+
},
|
|
7
|
+
convert(format) {
|
|
8
|
+
return this.branch({ format });
|
|
9
|
+
},
|
|
10
|
+
loader(options = {}) {
|
|
11
|
+
return this.branch({ loader: options });
|
|
12
|
+
},
|
|
13
|
+
saver(options = {}) {
|
|
14
|
+
return this.branch({ saver: options });
|
|
15
|
+
},
|
|
16
|
+
instrumenter(block) {
|
|
17
|
+
return this.branch({ instrumenter: block });
|
|
18
|
+
},
|
|
19
|
+
apply(operations) {
|
|
20
|
+
const pairs = Array.isArray(operations) ? operations : Object.entries(operations);
|
|
21
|
+
return pairs.reduce((builder, [name, argument]) => {
|
|
22
|
+
if (argument === true || argument == null) {
|
|
23
|
+
return rbFSend(builder, name);
|
|
24
|
+
}
|
|
25
|
+
else if (Array.isArray(argument)) {
|
|
26
|
+
return rbFSend(builder, name, ...argument);
|
|
27
|
+
}
|
|
28
|
+
else if (isPlainHash(argument)) {
|
|
29
|
+
return rbFSend(builder, name, argument);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return rbFSend(builder, name, argument);
|
|
33
|
+
}
|
|
34
|
+
}, this);
|
|
35
|
+
},
|
|
36
|
+
operation(name, ...args) {
|
|
37
|
+
const block = rbBlockGivenP(args.at(-1)) ? [args.pop()] : [];
|
|
38
|
+
return this.branch({ operations: [[name, args, ...block]] });
|
|
39
|
+
},
|
|
40
|
+
call(file = null, { destination = null, ...callOptions } = {}) {
|
|
41
|
+
const options = {};
|
|
42
|
+
if (file != null && file !== false)
|
|
43
|
+
options.source = file;
|
|
44
|
+
if (destination != null)
|
|
45
|
+
options.destination = destination;
|
|
46
|
+
return this.branch(options).callBang(callOptions);
|
|
47
|
+
},
|
|
48
|
+
branch(newOptions = {}) {
|
|
49
|
+
let options;
|
|
50
|
+
if (this instanceof ImageProcessing.Builder) {
|
|
51
|
+
options = this.options;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
options = { ...DEFAULT_OPTIONS, processor: this.Processor };
|
|
55
|
+
}
|
|
56
|
+
const merged = { ...options };
|
|
57
|
+
for (const [key, newValue] of Object.entries(newOptions)) {
|
|
58
|
+
if (!Object.hasOwn(options, key)) {
|
|
59
|
+
merged[key] = newValue;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const oldValue = options[key];
|
|
63
|
+
switch (key) {
|
|
64
|
+
case "loader":
|
|
65
|
+
case "saver":
|
|
66
|
+
merged[key] = { ...oldValue, ...newValue };
|
|
67
|
+
break;
|
|
68
|
+
case "operations":
|
|
69
|
+
merged[key] = [...oldValue, ...newValue];
|
|
70
|
+
break;
|
|
71
|
+
default:
|
|
72
|
+
merged[key] = newValue;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return new ImageProcessing.Builder(Object.freeze(merged));
|
|
76
|
+
},
|
|
77
|
+
/** @internal */
|
|
78
|
+
methodMissing(name, ...args) {
|
|
79
|
+
if (/^is[A-Z]/.test(name)) {
|
|
80
|
+
throw new NoMethodError(`undefined method '${name}' for an instance of ${this.constructor.name}`, name, args);
|
|
81
|
+
}
|
|
82
|
+
if (name.endsWith("Bang")) {
|
|
83
|
+
return rbFSend(this, name.slice(0, -"Bang".length), ...args).call();
|
|
84
|
+
}
|
|
85
|
+
return this.operation(name, ...args);
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
export const DEFAULT_OPTIONS = Object.freeze({
|
|
89
|
+
source: null,
|
|
90
|
+
loader: {},
|
|
91
|
+
saver: {},
|
|
92
|
+
format: null,
|
|
93
|
+
operations: [],
|
|
94
|
+
processor: null,
|
|
95
|
+
});
|
|
96
|
+
/** @noRailsEquivalent PERMANENT */
|
|
97
|
+
export function chainableProxy(host) {
|
|
98
|
+
const layer = Object.create(Object.getPrototypeOf(host), {
|
|
99
|
+
then: {
|
|
100
|
+
configurable: true,
|
|
101
|
+
writable: true,
|
|
102
|
+
value(resolve, reject) {
|
|
103
|
+
return this.call().then(resolve, reject);
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
Object.setPrototypeOf(host, new Proxy(layer, {
|
|
108
|
+
get(target, name, receiver) {
|
|
109
|
+
if (typeof name === "symbol" ||
|
|
110
|
+
name in target ||
|
|
111
|
+
name === "constructor" ||
|
|
112
|
+
PROTOCOL_PROBES.has(name) ||
|
|
113
|
+
Object.hasOwn(receiver, "constructor")) {
|
|
114
|
+
return Reflect.get(target, name, receiver);
|
|
115
|
+
}
|
|
116
|
+
return (...args) => receiver.methodMissing(name, ...args);
|
|
117
|
+
},
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
ImageProcessing.Chainable = Chainable;
|
|
121
|
+
//# sourceMappingURL=chainable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chainable.js","sourceRoot":"","sources":["../lib/chainable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,eAAe,EACf,aAAa,EACb,OAAO,GACR,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA8BlD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,MAAM,CAAsB,IAAa;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,CAAsB,MAAqB;QAChD,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,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@
|
|
|
1
|
+
import { defineConstants } from "@blazetrails/ruby-compat/classpath";
|
|
2
|
+
import * as m0 from "./builder.js";
|
|
3
|
+
import * as m1 from "./chainable.js";
|
|
4
|
+
import * as m2 from "./image-processing.js";
|
|
5
|
+
import * as m3 from "./pipeline.js";
|
|
6
|
+
import * as m4 from "./processor.js";
|
|
7
|
+
defineConstants([
|
|
8
|
+
[() => m0, "Builder", "ImageProcessing::Builder"],
|
|
9
|
+
[() => m1, "Chainable", "ImageProcessing::Chainable"],
|
|
10
|
+
[() => m2, "Error", "ImageProcessing::Error"],
|
|
11
|
+
[() => m3, "Pipeline", "ImageProcessing::Pipeline"],
|
|
12
|
+
[() => m4, "Processor", "ImageProcessing::Processor"],
|
|
13
|
+
]);
|
|
14
|
+
//# sourceMappingURL=constants.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.generated.js","sourceRoot":"","sources":["../lib/constants.generated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAErC,eAAe,CAAC;IACd,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,0BAA0B,CAAC;IACjD,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,4BAA4B,CAAC;IACrD,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,wBAAwB,CAAC;IAC7C,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,2BAA2B,CAAC;IACnD,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,4BAA4B,CAAC;CACtD,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StandardError } from "@blazetrails/ruby-compat";
|
|
2
|
+
export declare class Error extends StandardError {
|
|
3
|
+
}
|
|
4
|
+
export { Builder } from "./builder.js";
|
|
5
|
+
export { Chainable } from "./chainable.js";
|
|
6
|
+
export { Pipeline } from "./pipeline.js";
|
|
7
|
+
export { Processor } from "./processor.js";
|
|
8
|
+
export { ImageProcessing } from "./namespaces.js";
|
|
9
|
+
export type { ChainableHost } from "./chainable.js";
|
|
10
|
+
import "./constants.generated.js";
|
|
11
|
+
//# sourceMappingURL=image-processing.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StandardError } from "@blazetrails/ruby-compat";
|
|
2
|
+
import { ImageProcessing } from "./namespaces.js";
|
|
3
|
+
export class Error extends StandardError {
|
|
4
|
+
}
|
|
5
|
+
ImageProcessing.Error = Error;
|
|
6
|
+
export { Builder } from "./builder.js";
|
|
7
|
+
export { Chainable } from "./chainable.js";
|
|
8
|
+
export { Pipeline } from "./pipeline.js";
|
|
9
|
+
export { Processor } from "./processor.js";
|
|
10
|
+
export { ImageProcessing } from "./namespaces.js";
|
|
11
|
+
import "./constants.generated.js";
|
|
12
|
+
//# sourceMappingURL=image-processing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-processing.js","sourceRoot":"","sources":["../lib/image-processing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,OAAO,KAAM,SAAQ,aAAa;CAAG;AAC3C,eAAe,CAAC,KAAK,GAAG,KAAK,CAAC;AAE9B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type CliTool } from "@blazetrails/mini-magick/tool";
|
|
2
|
+
import { Processor as BaseProcessor } from "./processor.js";
|
|
3
|
+
type Options = Record<string, unknown>;
|
|
4
|
+
export declare class Processor extends BaseProcessor {
|
|
5
|
+
readonly magick: CliTool;
|
|
6
|
+
static SHARPEN_PARAMETERS: {
|
|
7
|
+
radius: number;
|
|
8
|
+
sigma: number;
|
|
9
|
+
};
|
|
10
|
+
static loadImage(pathOrMagick: string | CliTool, { loader, page, geometry, autoOrient, ...options }?: Options): CliTool;
|
|
11
|
+
static saveImage(magick: CliTool, destinationPath: string, { allowSplitting, ...options }?: Options): Promise<void>;
|
|
12
|
+
resizeToLimit(width: unknown, height: unknown, options?: Options): CliTool;
|
|
13
|
+
resizeToFit(width: unknown, height: unknown, options?: Options): CliTool;
|
|
14
|
+
resizeToFill(width: unknown, height: unknown, { gravity, ...options }?: Options): CliTool;
|
|
15
|
+
resizeAndPad(width: unknown, height: unknown, { background, gravity, ...options }?: Options): CliTool;
|
|
16
|
+
resizeToCover(width: unknown, height: unknown, options?: Options): CliTool;
|
|
17
|
+
crop(...args: unknown[]): CliTool;
|
|
18
|
+
rotate(degrees: unknown, { background }?: Options): CliTool;
|
|
19
|
+
composite(overlay?: unknown, kwargs?: Options | ((magick: CliTool) => unknown), block?: (magick: CliTool) => unknown): CliTool;
|
|
20
|
+
define(options: string | Record<string, Options>): CliTool;
|
|
21
|
+
limits(options: Options): CliTool;
|
|
22
|
+
append(...args: unknown[]): CliTool;
|
|
23
|
+
/** @internal */
|
|
24
|
+
private color;
|
|
25
|
+
/** @internal */
|
|
26
|
+
private thumbnail;
|
|
27
|
+
/** @internal */
|
|
28
|
+
private convertToPath;
|
|
29
|
+
static Utils: {
|
|
30
|
+
disallowSplitLayersBang(destinationPath: string): Promise<void>;
|
|
31
|
+
applyOptions(magick: CliTool, { define, ...options }: Options): void;
|
|
32
|
+
applyDefine(magick: CliTool, options: Record<string, Options>): CliTool;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export declare const MiniMagick: {
|
|
36
|
+
Processor: typeof Processor;
|
|
37
|
+
convertShim(block?: (convert: CliTool) => unknown): CliTool | Promise<unknown>;
|
|
38
|
+
isValidImage(file: {
|
|
39
|
+
path(): string;
|
|
40
|
+
}): Promise<boolean>;
|
|
41
|
+
source(this: import("./chainable.js").ChainableHost, file: unknown): import("./builder.js").Builder;
|
|
42
|
+
convert(this: import("./chainable.js").ChainableHost, format: string | null): import("./builder.js").Builder;
|
|
43
|
+
loader(this: import("./chainable.js").ChainableHost, options?: Record<string, unknown>): import("./builder.js").Builder;
|
|
44
|
+
saver(this: import("./chainable.js").ChainableHost, options?: Record<string, unknown>): import("./builder.js").Builder;
|
|
45
|
+
instrumenter(this: import("./chainable.js").ChainableHost, block: import("./chainable.js").Options["instrumenter"]): import("./builder.js").Builder;
|
|
46
|
+
apply(this: import("./chainable.js").ChainableHost, operations: Record<string, unknown> | [string, unknown][]): import("./chainable.js").ChainableHost;
|
|
47
|
+
operation(this: import("./chainable.js").ChainableHost, name: string, ...args: unknown[]): import("./builder.js").Builder;
|
|
48
|
+
call(this: import("./chainable.js").ChainableHost, file?: unknown, { destination, ...callOptions }?: {
|
|
49
|
+
destination?: string | null;
|
|
50
|
+
save?: boolean;
|
|
51
|
+
}): Promise<unknown>;
|
|
52
|
+
branch(this: import("./chainable.js").ChainableHost, newOptions?: Record<string, unknown>): import("./builder.js").Builder;
|
|
53
|
+
methodMissing(this: import("./chainable.js").ChainableHost, name: string, ...args: unknown[]): unknown;
|
|
54
|
+
};
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=mini-magick.d.ts.map
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { block as blockPass, Dir, File, format, isPlainHash, TypeError, rbBlockGivenP, rbGetKwargs, rbInspect, rbFSend, rbObjAsString, rbObjRespondTo, ArgumentError, warn, } from "@blazetrails/ruby-compat";
|
|
2
|
+
import * as MiniMagickGem from "@blazetrails/mini-magick";
|
|
3
|
+
import { Tool } from "@blazetrails/mini-magick/tool";
|
|
4
|
+
import { Chainable, chainableProxy } from "./chainable.js";
|
|
5
|
+
import { Error } from "./image-processing.js";
|
|
6
|
+
import { ImageProcessing } from "./namespaces.js";
|
|
7
|
+
import { Processor as BaseProcessor } from "./processor.js";
|
|
8
|
+
export class Processor extends BaseProcessor {
|
|
9
|
+
static {
|
|
10
|
+
this.accumulator("magick", Tool);
|
|
11
|
+
}
|
|
12
|
+
static SHARPEN_PARAMETERS = { radius: 0, sigma: 1 };
|
|
13
|
+
static loadImage(pathOrMagick, { loader = null, page = null, geometry = null, autoOrient = true, ...options } = {}) {
|
|
14
|
+
let magick;
|
|
15
|
+
if (pathOrMagick instanceof Tool) {
|
|
16
|
+
magick = pathOrMagick;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
const sourcePath = pathOrMagick;
|
|
20
|
+
magick = MiniMagick.convertShim();
|
|
21
|
+
Processor.Utils.applyOptions(magick, options);
|
|
22
|
+
let input = sourcePath;
|
|
23
|
+
if (loader != null && loader !== false)
|
|
24
|
+
input = `${loader}:${input}`;
|
|
25
|
+
if (page != null && page !== false)
|
|
26
|
+
input += `[${page}]`;
|
|
27
|
+
if (geometry != null && geometry !== false)
|
|
28
|
+
input += `[${geometry}]`;
|
|
29
|
+
magick.append(input);
|
|
30
|
+
}
|
|
31
|
+
if (autoOrient != null && autoOrient !== false)
|
|
32
|
+
magick.autoOrient();
|
|
33
|
+
return magick;
|
|
34
|
+
}
|
|
35
|
+
static async saveImage(magick, destinationPath, { allowSplitting = false, ...options } = {}) {
|
|
36
|
+
Processor.Utils.applyOptions(magick, options);
|
|
37
|
+
magick.append(destinationPath);
|
|
38
|
+
await magick.call();
|
|
39
|
+
if (allowSplitting == null || allowSplitting === false) {
|
|
40
|
+
await Processor.Utils.disallowSplitLayersBang(destinationPath);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
resizeToLimit(width, height, options = {}) {
|
|
44
|
+
return this.thumbnail(`${rbObjAsString(width)}x${rbObjAsString(height)}>`, options);
|
|
45
|
+
}
|
|
46
|
+
resizeToFit(width, height, options = {}) {
|
|
47
|
+
return this.thumbnail(`${rbObjAsString(width)}x${rbObjAsString(height)}`, options);
|
|
48
|
+
}
|
|
49
|
+
resizeToFill(width, height, { gravity = "Center", ...options } = {}) {
|
|
50
|
+
this.thumbnail(`${rbObjAsString(width)}x${rbObjAsString(height)}^`, options);
|
|
51
|
+
this.magick.gravity(gravity);
|
|
52
|
+
this.magick.background(this.color("transparent"));
|
|
53
|
+
return this.magick.extent(`${rbObjAsString(width)}x${rbObjAsString(height)}`);
|
|
54
|
+
}
|
|
55
|
+
resizeAndPad(width, height, { background = "transparent", gravity = "Center", ...options } = {}) {
|
|
56
|
+
this.thumbnail(`${rbObjAsString(width)}x${rbObjAsString(height)}`, options);
|
|
57
|
+
this.magick.background(this.color(background));
|
|
58
|
+
this.magick.gravity(gravity);
|
|
59
|
+
return this.magick.extent(`${rbObjAsString(width)}x${rbObjAsString(height)}`);
|
|
60
|
+
}
|
|
61
|
+
resizeToCover(width, height, options = {}) {
|
|
62
|
+
return this.thumbnail(`${rbObjAsString(width)}x${rbObjAsString(height)}^`, options);
|
|
63
|
+
}
|
|
64
|
+
crop(...args) {
|
|
65
|
+
switch (args.length) {
|
|
66
|
+
case 1:
|
|
67
|
+
return this.magick.crop(...args);
|
|
68
|
+
case 4:
|
|
69
|
+
return this.magick.crop(`${args[2]}x${args[3]}+${args[0]}+${args[1]}`);
|
|
70
|
+
default:
|
|
71
|
+
throw new ArgumentError(`wrong number of arguments (expected 1 or 4, got ${args.length})`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
rotate(degrees, { background = null } = {}) {
|
|
75
|
+
if (background != null && background !== false) {
|
|
76
|
+
this.magick.background(this.color(background));
|
|
77
|
+
}
|
|
78
|
+
return this.magick.rotate(degrees);
|
|
79
|
+
}
|
|
80
|
+
composite(overlay = ":none", kwargs = {}, block) {
|
|
81
|
+
if (rbBlockGivenP(kwargs)) {
|
|
82
|
+
block = kwargs;
|
|
83
|
+
kwargs = {};
|
|
84
|
+
}
|
|
85
|
+
const { mask = null, gravity = null, offset = null, args = null, ...options } = kwargs;
|
|
86
|
+
let { mode = null } = kwargs;
|
|
87
|
+
if (overlay === ":none")
|
|
88
|
+
return this.magick.composite();
|
|
89
|
+
if (Object.hasOwn(options, "compose")) {
|
|
90
|
+
warn("[IMAGE_PROCESSING] The :compose parameter in #composite has been renamed to :mode, the :compose alias will be removed in ImageProcessing 2.");
|
|
91
|
+
mode = options.compose;
|
|
92
|
+
}
|
|
93
|
+
let geometry;
|
|
94
|
+
if (Object.hasOwn(options, "geometry")) {
|
|
95
|
+
warn('[IMAGE_PROCESSING] The :geometry parameter in #composite has been deprecated and will be removed in ImageProcessing 2. Use :offset instead, e.g. `geometry: "+10+15"` should be replaced with `offset: [10, 15]`.');
|
|
96
|
+
geometry = options.geometry;
|
|
97
|
+
}
|
|
98
|
+
if (offset != null && offset !== false)
|
|
99
|
+
geometry = format("%+d%+d", ...offset);
|
|
100
|
+
const overlayPath = this.convertToPath(overlay, "overlay");
|
|
101
|
+
const maskPath = mask != null && mask !== false ? this.convertToPath(mask, "mask") : null;
|
|
102
|
+
this.magick.append(overlayPath);
|
|
103
|
+
if (maskPath != null)
|
|
104
|
+
this.magick.append(maskPath);
|
|
105
|
+
if (mode != null && mode !== false)
|
|
106
|
+
this.magick.compose(mode);
|
|
107
|
+
if (args != null && args !== false)
|
|
108
|
+
this.define({ compose: { args } });
|
|
109
|
+
if (gravity != null && gravity !== false)
|
|
110
|
+
this.magick.gravity(gravity);
|
|
111
|
+
if (geometry != null && geometry !== false)
|
|
112
|
+
this.magick.geometry(geometry);
|
|
113
|
+
if (block != null)
|
|
114
|
+
block(this.magick);
|
|
115
|
+
return this.magick.composite();
|
|
116
|
+
}
|
|
117
|
+
define(options) {
|
|
118
|
+
if (typeof options === "string")
|
|
119
|
+
return this.magick.define(options);
|
|
120
|
+
return Processor.Utils.applyDefine(this.magick, options);
|
|
121
|
+
}
|
|
122
|
+
limits(options) {
|
|
123
|
+
for (const [type, value] of Object.entries(options)) {
|
|
124
|
+
this.magick.args.unshift("-limit", String(type), String(value));
|
|
125
|
+
}
|
|
126
|
+
return this.magick;
|
|
127
|
+
}
|
|
128
|
+
append(...args) {
|
|
129
|
+
if (args.length === 0) {
|
|
130
|
+
return this.magick.methodMissing("append");
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
return this.magick.mergeBang(args);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/** @internal */
|
|
137
|
+
color(value) {
|
|
138
|
+
if (value === "transparent")
|
|
139
|
+
return "rgba(255,255,255,0.0)";
|
|
140
|
+
if (Array.isArray(value) && value.length === 3)
|
|
141
|
+
return `rgb(${value.join(",")})`;
|
|
142
|
+
if (Array.isArray(value) && value.length === 4)
|
|
143
|
+
return `rgba(${value.join(",")})`;
|
|
144
|
+
if (typeof value === "string")
|
|
145
|
+
return value;
|
|
146
|
+
throw new ArgumentError(`unrecognized color format: ${rbInspect(value)} (must be one of: string, 3-element RGB array, 4-element RGBA array)`);
|
|
147
|
+
}
|
|
148
|
+
/** @internal */
|
|
149
|
+
thumbnail(geometry, keywords = {}) {
|
|
150
|
+
rbGetKwargs(keywords, ["sharpen"]);
|
|
151
|
+
let { sharpen = null } = keywords;
|
|
152
|
+
this.magick.resize(geometry);
|
|
153
|
+
if (sharpen != null && sharpen !== false) {
|
|
154
|
+
if (!isPlainHash(sharpen)) {
|
|
155
|
+
throw new TypeError(`no implicit conversion of ${rbInspect(sharpen)} into Hash`);
|
|
156
|
+
}
|
|
157
|
+
sharpen = { ...Processor.SHARPEN_PARAMETERS, ...sharpen };
|
|
158
|
+
this.magick.sharpen(`${sharpen.radius}x${sharpen.sigma}`);
|
|
159
|
+
}
|
|
160
|
+
return this.magick;
|
|
161
|
+
}
|
|
162
|
+
/** @internal */
|
|
163
|
+
convertToPath(file, name) {
|
|
164
|
+
if (typeof file === "string") {
|
|
165
|
+
return file;
|
|
166
|
+
}
|
|
167
|
+
else if (rbObjRespondTo(file, "toPath")) {
|
|
168
|
+
return file.toPath();
|
|
169
|
+
}
|
|
170
|
+
else if (rbObjRespondTo(file, "path")) {
|
|
171
|
+
return file.path();
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
throw new ArgumentError(`${name} must be a String, Pathname, or respond to #path`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
static Utils = {
|
|
178
|
+
async disallowSplitLayersBang(destinationPath) {
|
|
179
|
+
const layers = await Dir.globAsync(destinationPath.replace(/(\.\w+)?$/, "-*$&"));
|
|
180
|
+
if (layers.length > 0) {
|
|
181
|
+
for (const path of layers)
|
|
182
|
+
await File.deleteAsync(path);
|
|
183
|
+
throw new Error("Source format is multi-layer, but destination format is single-layer. If you care only about the first layer, add `.loader(page: 0)` to your pipeline. If you want to process each layer, see https://github.com/janko/image_processing/wiki/Splitting-a-PDF-into-multiple-images or use `.saver(allow_splitting: true)`.");
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
applyOptions(magick, { define = {}, ...options }) {
|
|
187
|
+
for (const [option, value] of Object.entries(options)) {
|
|
188
|
+
if (value === true || value == null) {
|
|
189
|
+
rbFSend(magick, option);
|
|
190
|
+
}
|
|
191
|
+
else if (value === false) {
|
|
192
|
+
rbFSend(magick, option).plus();
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
rbFSend(magick, option, ...(Array.isArray(value) ? value : [value]));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
Processor.Utils.applyDefine(magick, define);
|
|
199
|
+
},
|
|
200
|
+
applyDefine(magick, options) {
|
|
201
|
+
for (const [rawNamespace, settings] of Object.entries(options)) {
|
|
202
|
+
const namespace = rawNamespace.replaceAll("_", "-");
|
|
203
|
+
for (const [rawKey, value] of Object.entries(settings)) {
|
|
204
|
+
const key = rawKey.replaceAll("_", "-");
|
|
205
|
+
magick.define(`${namespace}:${key}=${value}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return magick;
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
export const MiniMagick = {
|
|
213
|
+
...Chainable,
|
|
214
|
+
Processor,
|
|
215
|
+
convertShim(block) {
|
|
216
|
+
if (rbObjRespondTo(MiniMagickGem.MiniMagick, "convert")) {
|
|
217
|
+
return MiniMagickGem.MiniMagick.convert(...(block ? [blockPass(block)] : []));
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
return Tool.Convert.new(...(block ? [blockPass(block)] : []));
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
async isValidImage(file) {
|
|
224
|
+
try {
|
|
225
|
+
await MiniMagick.convertShim((convert) => {
|
|
226
|
+
convert.append(file.path());
|
|
227
|
+
convert.append("null:");
|
|
228
|
+
});
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
if (error instanceof MiniMagickGem.Error)
|
|
233
|
+
return false;
|
|
234
|
+
throw error;
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
chainableProxy(MiniMagick);
|
|
239
|
+
ImageProcessing.MiniMagick = MiniMagick;
|
|
240
|
+
//# sourceMappingURL=mini-magick.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mini-magick.js","sourceRoot":"","sources":["../lib/mini-magick.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,SAAS,EAClB,GAAG,EACH,IAAI,EACJ,MAAM,EACN,WAAW,EACX,SAAS,EACT,aAAa,EACb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aAAM,CAAC;YACN,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAyB,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,IAAwB;QACzC,IAAI,CAAC;YACH,MAAM,UAAU,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,EAAE;gBACvC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC5B,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC1B,CAAC,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,aAAa,CAAC,KAAK;gBAAE,OAAO,KAAK,CAAC;YACvD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF,CAAC;AAEF,cAAc,CAAC,UAAU,CAAC,CAAC;AAC3B,eAAe,CAAC,UAAU,GAAG,UAAU,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Autoload, type Extended } from "@blazetrails/activesupport";
|
|
2
|
+
import type { Builder } from "./builder.js";
|
|
3
|
+
import type { Chainable } from "./chainable.js";
|
|
4
|
+
import type { Error } from "./image-processing.js";
|
|
5
|
+
import type { Pipeline } from "./pipeline.js";
|
|
6
|
+
import type { Processor } from "./processor.js";
|
|
7
|
+
import type { MiniMagick } from "./mini-magick.js";
|
|
8
|
+
import type { Vips } from "./vips.js";
|
|
9
|
+
export declare const ImageProcessing: Autoload.Autoload & Extended<typeof Autoload> & {
|
|
10
|
+
Builder?: typeof Builder;
|
|
11
|
+
Chainable?: typeof Chainable;
|
|
12
|
+
Error?: typeof Error;
|
|
13
|
+
Pipeline?: typeof Pipeline;
|
|
14
|
+
Processor?: typeof Processor;
|
|
15
|
+
MiniMagick?: typeof MiniMagick;
|
|
16
|
+
Vips?: typeof Vips;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=namespaces.d.ts.map
|