pixelkiln 0.98.0 → 0.99.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/README.md +1 -1
- package/dist/cli.js +118 -11
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +87 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +394 -48
- package/dist/index.d.ts +394 -48
- package/dist/index.js +83 -3
- package/dist/index.js.map +1 -1
- package/docs/CLI.md +27 -4
- package/docs/ENDPOINTS.md +28 -1
- package/docs/PIXELLAB.md +1 -1
- package/docs/REVISIONS.md +9 -1
- package/package.json +1 -1
- package/schema/manifest.schema.json +43 -0
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ provenance and no long-lived npm token.
|
|
|
55
55
|
| Hand edits | Touch-ups in your own editor or a pinned in-browser Pixelorama, kept beside the generated art with the generation still the record; frame and tile sets member by member. |
|
|
56
56
|
| Controlled inputs | Hashed revision lineage (image-to-image and inpaint; on PixelLab also palette reduction, pixel cleanup, animation, skeleton posing, interpolation, and animation edits), fail-closed parent approval, source-versus-candidate review, and content-addressed per-asset ComfyUI bindings. |
|
|
57
57
|
| Characters | A base in 4 or 8 directions from a prompt or your own sprite (four PixelLab engines), poses, loops, portraits, and outfit transfers as dependent assets generated in waves, free mirrored directions (one `directions` list declares a loop and mirrors the rest), account adoption and salvage, and SpriteFrames export. |
|
|
58
|
-
| PixelLab utilities | `unzoom` returns upscaled reference art to its native grid, `pixelate` turns a photo or render into pixel art (Image to Pixel Art Pro Flash, 6 generations, or `--pro` for 20), `normal-map` makes a sprite's or a loop strip's normal map for lighting (0.5
|
|
58
|
+
| PixelLab utilities | `unzoom` returns upscaled reference art to its native grid, `pixelate` turns a photo or render into pixel art (Image to Pixel Art Pro Flash, 6 generations, or `--pro` for 20), `normal-map` makes a sprite's or a loop strip's normal map for lighting (0.1 generation, or 0.5 on pro), `vfx` builds animated effects such as explosions and auras with PixelLab's free VFX workbench, `font` generates a `.ttf` and glyph atlas, `music` makes a song (two MP3 takes, with optional seamless loops and loop points) and `sfx` a sound effect (WAV), `ui` splits a generated UI panel into elements, draws their hover and pressed states, sets 9-slice insets, and pulls every piece with a record, `asset` imports your own sprite as an object, expands it to 8 directions, resizes its canvas, and exports it as a spritesheet, `.aseprite` file or GIF, `estimate-skeleton` starts a keypoints file for skeleton animation, and `skeleton-preview` draws its poses over the sprite for free. |
|
|
59
59
|
| Existing-art onboarding | Manifest scaffolding, exact-hash account adoption, and prompt recovery. |
|
|
60
60
|
| Recovery | Safe stale-output replacement, validated caches, durable references, resumable paid jobs, and per-asset generation history with free restores. |
|
|
61
61
|
| Shared-account safety | Cross-project claim files or a registered workspace catalog, sibling-style exclusion, reviewed salvage, keep/discard tags, separate confirmed purge. |
|
package/dist/cli.js
CHANGED
|
@@ -135,6 +135,12 @@ var VALUE_FLAGS = [
|
|
|
135
135
|
"--size",
|
|
136
136
|
"--animation",
|
|
137
137
|
"--direction",
|
|
138
|
+
"--outline-rounding",
|
|
139
|
+
"--part-shapes",
|
|
140
|
+
"--surface-detail",
|
|
141
|
+
"--detail-softness",
|
|
142
|
+
"--mode",
|
|
143
|
+
"--strength",
|
|
138
144
|
"--bpm",
|
|
139
145
|
"--seconds",
|
|
140
146
|
"--lyrics",
|
|
@@ -538,6 +544,12 @@ function parseArgs(argv) {
|
|
|
538
544
|
sprite: get("--sprite"),
|
|
539
545
|
fps: numberOption("--fps", { min: 1, max: 60, integer: true }),
|
|
540
546
|
gamePack: rest.includes("--game-pack"),
|
|
547
|
+
mode: get("--mode"),
|
|
548
|
+
strength: numberOption("--strength", { min: 0, max: 2 }),
|
|
549
|
+
outlineRounding: numberOption("--outline-rounding", { min: 0, max: 3 }),
|
|
550
|
+
partShapes: numberOption("--part-shapes", { min: 0, max: 2 }),
|
|
551
|
+
surfaceDetail: numberOption("--surface-detail", { min: 0, max: 2 }),
|
|
552
|
+
detailSoftness: numberOption("--detail-softness", { min: 0.6, max: 3 }),
|
|
541
553
|
kind: get("--kind"),
|
|
542
554
|
size: get("--size"),
|
|
543
555
|
animation: get("--animation"),
|
|
@@ -638,8 +650,10 @@ Commands
|
|
|
638
650
|
generations; asks first.
|
|
639
651
|
normal-map PixelLab: make the normal map of a PNG sprite (--from), or of a
|
|
640
652
|
horizontal strip of --frames equal frames, so an engine can light
|
|
641
|
-
it. --convention opengl (default) or directx. 0.
|
|
642
|
-
|
|
653
|
+
it. --convention opengl (default) or directx. 0.1 generation on
|
|
654
|
+
lite (default), 0.5 with --mode pro; shape it with --strength,
|
|
655
|
+
--outline-rounding, --part-shapes, --surface-detail and
|
|
656
|
+
--detail-softness. Asks first.
|
|
643
657
|
vfx PixelLab: build an animated pixel-art effect with the VFX
|
|
644
658
|
workbench (free) from a --preset, a --recipe file, a saved
|
|
645
659
|
--effect, and/or --part; writes <out>.png/.gif/.json and a
|
|
@@ -694,7 +708,14 @@ Options
|
|
|
694
708
|
--artist <a> vfx --description: lite (default) or pro
|
|
695
709
|
--weight <w> font: Bold or Regular (default)
|
|
696
710
|
--id <id> ui/asset: the PixelLab asset to work on
|
|
697
|
-
--kind <kind> asset: object (default) or character
|
|
711
|
+
--kind <kind> asset: object (default) or character; normal-map: what the
|
|
712
|
+
picture is (character, object, topdown, side, iso, ui)
|
|
713
|
+
--mode <mode> normal-map: lite (default, 0.1 generation) or pro (0.5)
|
|
714
|
+
--strength <n> normal-map: how far pixels tilt from the viewer, 0-2
|
|
715
|
+
--outline-rounding <n> normal-map: how much the outline rounds off, 0-3
|
|
716
|
+
--part-shapes <n> normal-map: how much the sprite's 3D parts add, 0-2
|
|
717
|
+
--surface-detail <n> normal-map: the art's light and dark as bumps, 0-2
|
|
718
|
+
--detail-softness <n> normal-map: blur of that detail in px, 0.6-3
|
|
698
719
|
--size <WxH> asset canvas: the new canvas, in multiples of 4
|
|
699
720
|
--animation <id> asset mirror/export: an animation group id
|
|
700
721
|
--direction <dir> asset mirror: the direction to flip; asset expand: the
|
|
@@ -1477,6 +1498,14 @@ function specHash(spec, styleImageHashes, providerOptionIdentity = spec.provider
|
|
|
1477
1498
|
description: spec.revision.description,
|
|
1478
1499
|
removalTask: spec.revision.removalTask,
|
|
1479
1500
|
convention: spec.revision.convention,
|
|
1501
|
+
// Each only when set, so normal-map revisions made before them keep their hash.
|
|
1502
|
+
normalMapMode: spec.revision.normalMapMode,
|
|
1503
|
+
normalMapKind: spec.revision.normalMapKind,
|
|
1504
|
+
normalMapStrength: spec.revision.normalMapStrength,
|
|
1505
|
+
outlineRounding: spec.revision.outlineRounding,
|
|
1506
|
+
partShapes: spec.revision.partShapes,
|
|
1507
|
+
surfaceDetail: spec.revision.surfaceDetail,
|
|
1508
|
+
detailSoftness: spec.revision.detailSoftness,
|
|
1480
1509
|
driftThreshold: spec.revision.driftThreshold,
|
|
1481
1510
|
subjectDescription: spec.revision.subjectDescription,
|
|
1482
1511
|
initialPose: spec.revision.initialPose,
|
|
@@ -2037,6 +2066,24 @@ var RevisionSchema = z.object({
|
|
|
2037
2066
|
removalTask: z.enum(["simple", "complex"]).optional(),
|
|
2038
2067
|
/** `normal-map` only: `opengl` (green up; PixelLab's default) or `directx` (green down, for Unreal). */
|
|
2039
2068
|
convention: NormalMapConventionSchema.optional(),
|
|
2069
|
+
/**
|
|
2070
|
+
* `normal-map` only: `lite` (PixelLab's default, 0.1 generation) makes the
|
|
2071
|
+
* map from the art alone; `pro` (0.5) plans each part's shape, what is in
|
|
2072
|
+
* front and what is sunk.
|
|
2073
|
+
*/
|
|
2074
|
+
normalMapMode: z.enum(["lite", "pro"]).optional(),
|
|
2075
|
+
/** `normal-map` only: what the picture is. Left out, PixelLab reads it from the picture; set it for sidescroller, isometric and UI art. */
|
|
2076
|
+
normalMapKind: z.enum(["character", "object", "topdown", "side", "iso", "ui"]).optional(),
|
|
2077
|
+
/** `normal-map` only: how far every pixel tilts away from facing the viewer, 0 to 2 (the API refuses more). */
|
|
2078
|
+
normalMapStrength: z.number().min(0).max(2).optional(),
|
|
2079
|
+
/** `normal-map` only: how much the outline rounds off, 0 to 3; 0 keeps it flat to the edge. */
|
|
2080
|
+
outlineRounding: z.number().min(0).max(3).optional(),
|
|
2081
|
+
/** `normal-map` only: how much the sprite's 3D parts (a round head, an arm) add, 0 to 2. */
|
|
2082
|
+
partShapes: z.number().min(0).max(2).optional(),
|
|
2083
|
+
/** `normal-map` only: the art's own light and dark as bumps, 0 to 2; 0 for a smooth surface. */
|
|
2084
|
+
surfaceDetail: z.number().min(0).max(2).optional(),
|
|
2085
|
+
/** `normal-map` only: how far that detail is blurred, 0.6 to 3 px. */
|
|
2086
|
+
detailSoftness: z.number().min(0.6).max(3).optional(),
|
|
2040
2087
|
/**
|
|
2041
2088
|
* `animate-skeleton`: what the character *looks like*, a noun
|
|
2042
2089
|
* phrase (colours, clothing, held items) — distinct from the asset's
|
|
@@ -2197,6 +2244,15 @@ var RevisionSchema = z.object({
|
|
|
2197
2244
|
path: ["convention"]
|
|
2198
2245
|
});
|
|
2199
2246
|
}
|
|
2247
|
+
for (const field of ["normalMapMode", "normalMapKind", "normalMapStrength", "outlineRounding", "partShapes", "surfaceDetail", "detailSoftness"]) {
|
|
2248
|
+
if (revision[field] !== void 0 && revision.mode !== "normal-map") {
|
|
2249
|
+
context.addIssue({
|
|
2250
|
+
code: z.ZodIssueCode.custom,
|
|
2251
|
+
message: `${field} applies to normal-map revisions only`,
|
|
2252
|
+
path: [field]
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2200
2256
|
if (revision.description !== void 0 && revision.mode !== "animate-skeleton" && revision.mode !== "remove-background") {
|
|
2201
2257
|
context.addIssue({
|
|
2202
2258
|
code: z.ZodIssueCode.custom,
|
|
@@ -7509,6 +7565,8 @@ function targetPaletteBody(palette) {
|
|
|
7509
7565
|
}
|
|
7510
7566
|
};
|
|
7511
7567
|
}
|
|
7568
|
+
var NORMAL_MAP_MODES = ["lite", "pro"];
|
|
7569
|
+
var NORMAL_MAP_KINDS = ["character", "object", "topdown", "side", "iso", "ui"];
|
|
7512
7570
|
var PixelLabClient = class {
|
|
7513
7571
|
constructor(apiKey, timeoutMs = 12e4) {
|
|
7514
7572
|
this.apiKey = apiKey;
|
|
@@ -8587,8 +8645,15 @@ var PixelLabClient = class {
|
|
|
8587
8645
|
*/
|
|
8588
8646
|
async normalMap(args) {
|
|
8589
8647
|
const body = { image: args.image };
|
|
8648
|
+
if (args.mode) body.mode = args.mode;
|
|
8649
|
+
if (args.kind) body.kind = args.kind;
|
|
8650
|
+
if (args.shape?.strength != null) body.strength = args.shape.strength;
|
|
8590
8651
|
if (args.frames != null && args.frames !== 1) body.frames = args.frames;
|
|
8591
8652
|
if (args.convention) body.convention = args.convention;
|
|
8653
|
+
if (args.shape?.outlineRounding != null) body.outline_rounding = args.shape.outlineRounding;
|
|
8654
|
+
if (args.shape?.partShapes != null) body.part_shapes = args.shape.partShapes;
|
|
8655
|
+
if (args.shape?.surfaceDetail != null) body.surface_detail = args.shape.surfaceDetail;
|
|
8656
|
+
if (args.shape?.detailSoftness != null) body.detail_softness = args.shape.detailSoftness;
|
|
8592
8657
|
return validateResponse(
|
|
8593
8658
|
RevisionJobSubmitSchema,
|
|
8594
8659
|
await this.request("/normal-map", { method: "POST", body: JSON.stringify(body) }),
|
|
@@ -9798,7 +9863,9 @@ async function pixelateFile(client2, input, opts = {}) {
|
|
|
9798
9863
|
await sleep3(interval);
|
|
9799
9864
|
}
|
|
9800
9865
|
}
|
|
9801
|
-
|
|
9866
|
+
function normalMapCost(mode2) {
|
|
9867
|
+
return mode2 === "pro" ? 0.5 : 0.1;
|
|
9868
|
+
}
|
|
9802
9869
|
var NORMAL_MAP_MIN_SIDE = 8;
|
|
9803
9870
|
var NORMAL_MAP_MAX_SIDE = 512;
|
|
9804
9871
|
var NORMAL_MAP_MAX_FRAMES = 32;
|
|
@@ -9842,7 +9909,10 @@ async function normalMapFile(client2, input, opts = {}) {
|
|
|
9842
9909
|
const submitted = await client2.normalMap({
|
|
9843
9910
|
image: { base64: bytes.toString("base64"), format: "png" },
|
|
9844
9911
|
frames,
|
|
9845
|
-
convention: opts.convention
|
|
9912
|
+
convention: opts.convention,
|
|
9913
|
+
shape: opts.shape,
|
|
9914
|
+
mode: opts.mode,
|
|
9915
|
+
kind: opts.kind
|
|
9846
9916
|
});
|
|
9847
9917
|
const jobId = submitted.background_job_id;
|
|
9848
9918
|
const started = Date.now();
|
|
@@ -10166,7 +10236,7 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
10166
10236
|
return { unit: "generations", amount: 1, candidates: 1 };
|
|
10167
10237
|
}
|
|
10168
10238
|
if (spec.revision?.mode === "normal-map") {
|
|
10169
|
-
return { unit: "generations", amount:
|
|
10239
|
+
return { unit: "generations", amount: normalMapCost(spec.revision.normalMapMode), candidates: 1 };
|
|
10170
10240
|
}
|
|
10171
10241
|
if (spec.revision?.mode === "reduce-colors" || spec.revision?.mode === "correct-pixelart") {
|
|
10172
10242
|
return { unit: "generations", amount: 0.1, candidates: 1 };
|
|
@@ -11640,7 +11710,20 @@ var PixelLabProvider = class _PixelLabProvider {
|
|
|
11640
11710
|
}
|
|
11641
11711
|
if (revision.mode === "normal-map") {
|
|
11642
11712
|
const strip = roles ? { base64: joinStripPng(images.map((member) => Buffer.from(member.base64, "base64"))).toString("base64"), format: "png" } : image;
|
|
11643
|
-
const res2 = await this.client.normalMap({
|
|
11713
|
+
const res2 = await this.client.normalMap({
|
|
11714
|
+
image: strip,
|
|
11715
|
+
frames: roles?.length ?? 1,
|
|
11716
|
+
convention: revision.convention,
|
|
11717
|
+
mode: revision.normalMapMode,
|
|
11718
|
+
kind: revision.normalMapKind,
|
|
11719
|
+
shape: {
|
|
11720
|
+
strength: revision.normalMapStrength,
|
|
11721
|
+
outlineRounding: revision.outlineRounding,
|
|
11722
|
+
partShapes: revision.partShapes,
|
|
11723
|
+
surfaceDetail: revision.surfaceDetail,
|
|
11724
|
+
detailSoftness: revision.detailSoftness
|
|
11725
|
+
}
|
|
11726
|
+
});
|
|
11644
11727
|
return {
|
|
11645
11728
|
jobId: res2.background_job_id,
|
|
11646
11729
|
metadata: roles ? { revisionMembers: roles, ...revision.sourceFps != null ? { revisionFps: revision.sourceFps } : {} } : {}
|
|
@@ -14881,6 +14964,13 @@ async function resolveSpecs(loaded, filter) {
|
|
|
14881
14964
|
...asset.revision.description ? { description: asset.revision.description } : {},
|
|
14882
14965
|
...asset.revision.removalTask ? { removalTask: asset.revision.removalTask } : {},
|
|
14883
14966
|
...asset.revision.convention ? { convention: asset.revision.convention } : {},
|
|
14967
|
+
...asset.revision.normalMapMode ? { normalMapMode: asset.revision.normalMapMode } : {},
|
|
14968
|
+
...asset.revision.normalMapKind ? { normalMapKind: asset.revision.normalMapKind } : {},
|
|
14969
|
+
...asset.revision.normalMapStrength == null ? {} : { normalMapStrength: asset.revision.normalMapStrength },
|
|
14970
|
+
...asset.revision.outlineRounding == null ? {} : { outlineRounding: asset.revision.outlineRounding },
|
|
14971
|
+
...asset.revision.partShapes == null ? {} : { partShapes: asset.revision.partShapes },
|
|
14972
|
+
...asset.revision.surfaceDetail == null ? {} : { surfaceDetail: asset.revision.surfaceDetail },
|
|
14973
|
+
...asset.revision.detailSoftness == null ? {} : { detailSoftness: asset.revision.detailSoftness },
|
|
14884
14974
|
...asset.revision.driftThreshold == null ? {} : { driftThreshold: asset.revision.driftThreshold },
|
|
14885
14975
|
...asset.revision.subjectDescription ? { subjectDescription: asset.revision.subjectDescription } : {},
|
|
14886
14976
|
...asset.revision.initialPose ? { initialPose: asset.revision.initialPose } : {},
|
|
@@ -24583,21 +24673,38 @@ async function runNormalMap(args) {
|
|
|
24583
24673
|
log(
|
|
24584
24674
|
` normal-map ${args.from}${frames > 1 ? ` (a strip of ${frames} frames)` : ""} \u2192 ${out}, ${convention} (green ${convention === "opengl" ? "up" : "down"})`
|
|
24585
24675
|
);
|
|
24586
|
-
|
|
24587
|
-
|
|
24588
|
-
|
|
24676
|
+
if (args.mode !== void 0 && !NORMAL_MAP_MODES.includes(args.mode)) {
|
|
24677
|
+
throw new UsageError(`--mode must be ${NORMAL_MAP_MODES.join(" or ")}, got "${args.mode}"`);
|
|
24678
|
+
}
|
|
24679
|
+
if (args.kind !== void 0 && !NORMAL_MAP_KINDS.includes(args.kind)) {
|
|
24680
|
+
throw new UsageError(`--kind must be one of ${NORMAL_MAP_KINDS.join(", ")}, got "${args.kind}"`);
|
|
24681
|
+
}
|
|
24682
|
+
const mode2 = args.mode;
|
|
24683
|
+
const cost = normalMapCost(mode2);
|
|
24684
|
+
log(` cost: ${cost} generation (${mode2 === "pro" ? "pro" : "lite, PixelLab's default; --mode pro is 0.5"}, charged on delivery)`);
|
|
24685
|
+
if (args.budget !== void 0 && args.budget < cost) {
|
|
24686
|
+
throw new Error(`--budget ${args.budget} is below this normal map's ${cost}-generation cost`);
|
|
24589
24687
|
}
|
|
24590
24688
|
if (args.dryRun) {
|
|
24591
24689
|
log(" dry run: nothing sent");
|
|
24592
24690
|
return;
|
|
24593
24691
|
}
|
|
24594
|
-
if (!await confirm(` Spend ${
|
|
24692
|
+
if (!await confirm(` Spend ${cost} generation on this normal map?`, args.yes)) return;
|
|
24595
24693
|
loadKeys(args);
|
|
24596
24694
|
let last = "";
|
|
24597
24695
|
const res = await normalMapFile(clientFromEnv(), args.from, {
|
|
24598
24696
|
out,
|
|
24599
24697
|
frames,
|
|
24600
24698
|
convention: args.convention ? convention : void 0,
|
|
24699
|
+
mode: mode2,
|
|
24700
|
+
kind: args.kind,
|
|
24701
|
+
shape: {
|
|
24702
|
+
strength: args.strength,
|
|
24703
|
+
outlineRounding: args.outlineRounding,
|
|
24704
|
+
partShapes: args.partShapes,
|
|
24705
|
+
surfaceDetail: args.surfaceDetail,
|
|
24706
|
+
detailSoftness: args.detailSoftness
|
|
24707
|
+
},
|
|
24601
24708
|
force: args.force,
|
|
24602
24709
|
onProgress: (status) => {
|
|
24603
24710
|
if (status !== last) log(` ${status}\u2026`);
|