@agent-media/image 0.6.1 → 0.8.0
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/dist/actions/edit.d.ts +4 -3
- package/dist/actions/edit.d.ts.map +1 -1
- package/dist/actions/edit.js +8 -8
- package/dist/actions/edit.js.map +1 -1
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +1 -0
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/upscale.d.ts +21 -0
- package/dist/actions/upscale.d.ts.map +1 -0
- package/dist/actions/upscale.js +27 -0
- package/dist/actions/upscale.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/actions/edit.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MediaResult } from '@agent-media/core';
|
|
2
2
|
export interface EditInput {
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/** One or more input file paths or URLs */
|
|
4
|
+
inputs: string[];
|
|
5
5
|
/** Text prompt describing the desired edit */
|
|
6
6
|
prompt: string;
|
|
7
7
|
/** Output directory (overrides default) */
|
|
@@ -15,7 +15,8 @@ export interface EditInput {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Edit an image using a text prompt (image-to-image)
|
|
18
|
-
*
|
|
18
|
+
* Supports multiple input images for multi-image editing
|
|
19
|
+
* Requires an external provider (fal, replicate, runpod, ai-gateway)
|
|
19
20
|
*/
|
|
20
21
|
export declare function edit(options: EditInput): Promise<MediaResult>;
|
|
21
22
|
//# sourceMappingURL=edit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/actions/edit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAA6B,MAAM,mBAAmB,CAAC;AAGhF,MAAM,WAAW,SAAS;IACxB,
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/actions/edit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAA6B,MAAM,mBAAmB,CAAC;AAGhF,MAAM,WAAW,SAAS;IACxB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAsB,IAAI,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAyBnE"}
|
package/dist/actions/edit.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { executeAction, globalRegistry } from '@agent-media/core';
|
|
2
2
|
/**
|
|
3
3
|
* Edit an image using a text prompt (image-to-image)
|
|
4
|
-
*
|
|
4
|
+
* Supports multiple input images for multi-image editing
|
|
5
|
+
* Requires an external provider (fal, replicate, runpod, ai-gateway)
|
|
5
6
|
*/
|
|
6
7
|
export async function edit(options) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
8
|
+
const mediaInputs = options.inputs.map((input) => ({
|
|
9
|
+
source: input,
|
|
10
|
+
isUrl: input.startsWith('http://') || input.startsWith('https://'),
|
|
11
|
+
}));
|
|
12
12
|
const context = {
|
|
13
13
|
outputDir: options.out ?? process.cwd(),
|
|
14
14
|
provider: options.provider,
|
|
15
15
|
outputName: options.name,
|
|
16
|
-
inputSource: options.
|
|
16
|
+
inputSource: options.inputs[0],
|
|
17
17
|
};
|
|
18
18
|
return executeAction(globalRegistry, {
|
|
19
19
|
action: 'edit',
|
|
20
20
|
options: {
|
|
21
|
-
|
|
21
|
+
inputs: mediaInputs,
|
|
22
22
|
prompt: options.prompt,
|
|
23
23
|
model: options.model,
|
|
24
24
|
},
|
package/dist/actions/edit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../src/actions/edit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAiBlE
|
|
1
|
+
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../src/actions/edit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAiBlE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAkB;IAC3C,MAAM,WAAW,GAAiB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC/D,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC;KACnE,CAAC,CAAC,CAAC;IAEJ,MAAM,OAAO,GAAkB;QAC7B,SAAS,EAAE,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;QACvC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,UAAU,EAAE,OAAO,CAAC,IAAI;QACxB,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;KAC/B,CAAC;IAEF,OAAO,aAAa,CAClB,cAAc,EACd;QACE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,MAAM,EAAE,WAAW;YACnB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB;KACF,EACD,OAAO,CACR,CAAC;AACJ,CAAC"}
|
package/dist/actions/index.d.ts
CHANGED
|
@@ -12,4 +12,6 @@ export { edit } from './edit.js';
|
|
|
12
12
|
export type { EditInput } from './edit.js';
|
|
13
13
|
export { crop } from './crop.js';
|
|
14
14
|
export type { CropInput } from './crop.js';
|
|
15
|
+
export { upscale } from './upscale.js';
|
|
16
|
+
export type { UpscaleInput } from './upscale.js';
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/actions/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MediaResult } from '@agent-media/core';
|
|
2
|
+
export interface UpscaleInput {
|
|
3
|
+
/** Input file path or URL */
|
|
4
|
+
input: string;
|
|
5
|
+
/** Scale factor (e.g., 2 or 4, default: 2) */
|
|
6
|
+
scale?: number;
|
|
7
|
+
/** Output directory (overrides default) */
|
|
8
|
+
out?: string;
|
|
9
|
+
/** Output filename (extension auto-added if missing) */
|
|
10
|
+
name?: string;
|
|
11
|
+
/** Provider to use (overrides auto-detection) */
|
|
12
|
+
provider?: string;
|
|
13
|
+
/** Model to use (overrides provider default) */
|
|
14
|
+
model?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Upscale an image using AI super-resolution
|
|
18
|
+
* Supports local (Swin2SR), fal (ESRGAN), and replicate (Real-ESRGAN) providers
|
|
19
|
+
*/
|
|
20
|
+
export declare function upscale(options: UpscaleInput): Promise<MediaResult>;
|
|
21
|
+
//# sourceMappingURL=upscale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upscale.d.ts","sourceRoot":"","sources":["../../src/actions/upscale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAA6B,MAAM,mBAAmB,CAAC;AAGhF,MAAM,WAAW,YAAY;IAC3B,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CA2BzE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { executeAction, globalRegistry } from '@agent-media/core';
|
|
2
|
+
/**
|
|
3
|
+
* Upscale an image using AI super-resolution
|
|
4
|
+
* Supports local (Swin2SR), fal (ESRGAN), and replicate (Real-ESRGAN) providers
|
|
5
|
+
*/
|
|
6
|
+
export async function upscale(options) {
|
|
7
|
+
const isUrl = options.input.startsWith('http://') || options.input.startsWith('https://');
|
|
8
|
+
const input = {
|
|
9
|
+
source: options.input,
|
|
10
|
+
isUrl,
|
|
11
|
+
};
|
|
12
|
+
const context = {
|
|
13
|
+
outputDir: options.out ?? process.cwd(),
|
|
14
|
+
provider: options.provider,
|
|
15
|
+
outputName: options.name,
|
|
16
|
+
inputSource: options.input,
|
|
17
|
+
};
|
|
18
|
+
return executeAction(globalRegistry, {
|
|
19
|
+
action: 'upscale',
|
|
20
|
+
options: {
|
|
21
|
+
input,
|
|
22
|
+
scale: options.scale,
|
|
23
|
+
model: options.model,
|
|
24
|
+
},
|
|
25
|
+
}, context);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=upscale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upscale.js","sourceRoot":"","sources":["../../src/actions/upscale.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAiBlE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAAqB;IACjD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAE1F,MAAM,KAAK,GAAe;QACxB,MAAM,EAAE,OAAO,CAAC,KAAK;QACrB,KAAK;KACN,CAAC;IAEF,MAAM,OAAO,GAAkB;QAC7B,SAAS,EAAE,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;QACvC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,UAAU,EAAE,OAAO,CAAC,IAAI;QACxB,WAAW,EAAE,OAAO,CAAC,KAAK;KAC3B,CAAC;IAEF,OAAO,aAAa,CAClB,cAAc,EACd;QACE,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE;YACP,KAAK;YACL,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB;KACF,EACD,OAAO,CACR,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { resize, convert, removeBackground, generate, extend, edit, crop, } from './actions/index.js';
|
|
2
|
-
export type { ResizeInput, ConvertInput, RemoveBackgroundInput, GenerateInput, ExtendInput, EditInput, CropInput, } from './actions/index.js';
|
|
1
|
+
export { resize, convert, removeBackground, generate, extend, edit, crop, upscale, } from './actions/index.js';
|
|
2
|
+
export type { ResizeInput, ConvertInput, RemoveBackgroundInput, GenerateInput, ExtendInput, EditInput, CropInput, UpscaleInput, } from './actions/index.js';
|
|
3
3
|
export type { MediaResult, MediaSuccessResult, MediaErrorResult, ImageFormat, } from '@agent-media/core';
|
|
4
4
|
export { isSuccess, isError, printResult } from '@agent-media/core';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,OAAO,GACR,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,aAAa,EACb,WAAW,EACX,SAAS,EACT,SAAS,EACT,YAAY,GACb,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Export all actions
|
|
2
|
-
export { resize, convert, removeBackground, generate, extend, edit, crop, } from './actions/index.js';
|
|
2
|
+
export { resize, convert, removeBackground, generate, extend, edit, crop, upscale, } from './actions/index.js';
|
|
3
3
|
export { isSuccess, isError, printResult } from '@agent-media/core';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,OAAO,EACL,MAAM,EACN,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,OAAO,EACL,MAAM,EACN,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,OAAO,GACR,MAAM,oBAAoB,CAAC;AAsB5B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-media/image",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Image actions for agent-media toolkit",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@agent-media/core": "0.
|
|
29
|
-
"@agent-media/providers": "0.
|
|
28
|
+
"@agent-media/core": "0.11.0",
|
|
29
|
+
"@agent-media/providers": "0.11.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^22.0.0",
|