@doufunao123/asset-gateway 0.11.1 → 0.12.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/index.js +29 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -627,7 +627,7 @@ import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
|
627
627
|
import { dirname as dirname2, join as join2 } from "path";
|
|
628
628
|
import { Command as Command3 } from "commander";
|
|
629
629
|
function inferExtension(assetType) {
|
|
630
|
-
const map = { image: "png", audio: "mp3", music: "mp3", tts: "mp3", video: "mp4", model3d: "glb", text: "txt" };
|
|
630
|
+
const map = { image: "png", audio: "mp3", music: "mp3", tts: "mp3", video: "mp4", model3d: "glb", text: "txt", sprite: "png" };
|
|
631
631
|
return map[assetType] ?? "bin";
|
|
632
632
|
}
|
|
633
633
|
function stripDataUri(data) {
|
|
@@ -913,6 +913,34 @@ function createGenerateCommand() {
|
|
|
913
913
|
}
|
|
914
914
|
})
|
|
915
915
|
);
|
|
916
|
+
command.addCommand(
|
|
917
|
+
new Command3("sprite").description("Animate a sprite image using PixelEngine AI").requiredOption("--prompt <text>", "Animation prompt describing the desired motion").requiredOption("--input <path>", "Input sprite image (local path or URL)").option("--model <model>", "Model: pixel-engine-v1.1 or frame-engine-v1.1", "pixel-engine-v1.1").option("--output-frames <n>", "Number of animation frames (even integer)", "8").option("--output-format <fmt>", "Output format: spritesheet, webp, gif", "spritesheet").option("--colors <n>", "Pixel palette color count (2-256, pixel model only)").option("--negative-prompt <text>", "What to avoid in the generation").option("--seed <n>", "Seed for reproducibility").option("--matte-color <hex>", "Matte color for alpha flattening (6-char hex)").option("--enhance-prompt", "Enhance the prompt before generation").option("--output-dir <dir>", "Directory to save output", ".").action(async function(options) {
|
|
918
|
+
try {
|
|
919
|
+
const ctx = createContext(this);
|
|
920
|
+
const params = {
|
|
921
|
+
output_frames: Number(options.outputFrames),
|
|
922
|
+
output_format: options.outputFormat
|
|
923
|
+
};
|
|
924
|
+
if (options.colors) params.pixel_config = { colors: Number(options.colors) };
|
|
925
|
+
if (options.negativePrompt) params.negative_prompt = options.negativePrompt;
|
|
926
|
+
if (options.seed) params.seed = Number(options.seed);
|
|
927
|
+
if (options.matteColor) params.matte_color = options.matteColor;
|
|
928
|
+
const body = {
|
|
929
|
+
asset_type: "sprite",
|
|
930
|
+
prompt: options.prompt,
|
|
931
|
+
model: options.model,
|
|
932
|
+
input_file: options.input,
|
|
933
|
+
params
|
|
934
|
+
};
|
|
935
|
+
const data = await ctx.client.post("/api/generate", body);
|
|
936
|
+
const localPath = await saveOutput(data, "sprite", options.outputDir);
|
|
937
|
+
if (localPath) data.local_path = localPath;
|
|
938
|
+
printSuccess("generate.sprite", data, ctx);
|
|
939
|
+
} catch (error2) {
|
|
940
|
+
printError("generate.sprite", error2);
|
|
941
|
+
}
|
|
942
|
+
})
|
|
943
|
+
);
|
|
916
944
|
return command;
|
|
917
945
|
}
|
|
918
946
|
|