improve image gen prompting. increase cfg from 1->3 to make prompt follow more aggressively
This commit is contained in:
@@ -7,23 +7,22 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const COMFYUI_URL = process.env.COMFYUI_URL || "http://localhost:8188";
|
||||
|
||||
// Drawing style prefix
|
||||
const STYLE_PREFIX = `a high-contrast, black and white pen and ink drawing, hand-drawn sketch aesthetic, very low detail, extremely minimal, visible loose linework, expressive simple hatching for shadows, quick conceptual sketch, subtle color accent`;
|
||||
const STYLE_PREFIX = `clean line art, minimalist sketch, concept art sketch, black and white line drawing, lots of white space, sparse shading, simple hatching, very low detail, subtle color accent`;
|
||||
|
||||
// 1. Generate engineered visual prompt
|
||||
async function generateVisualPrompt(flavor) {
|
||||
const rawPrompt = await callOllama(
|
||||
`You are a prompt engineer specializing in visual prompts for AI image generation (e.g., Stable Diffusion, ComfyUI). Given a piece of fantasy flavor text, your job is to extract and translate the visual elements into a highly descriptive image prompt.
|
||||
`You are a prompt engineer specializing in visual prompts for AI image generation. Your goal is to translate fantasy flavor text into a sparse, minimalist scene description.
|
||||
|
||||
Your output should be structured like a list of visual tags, not a story or paragraph. Focus on describing the environment, mood, architecture, lighting, materials, and color. Avoid abstract, emotional, and visual language. Be literal, specific, and visual only.
|
||||
Your output must be a simple list of visual tags describing only the most essential elements of the scene. Focus on the core subject and mood.
|
||||
|
||||
Rules:
|
||||
- Do NOT repeat phrases or wording from the input.
|
||||
- Only include things that could be seen in a single, still image.
|
||||
- Use visual keywords, rich adjectives, and clear scene descriptors.
|
||||
- Keep the prompt concise, 40-80 words.
|
||||
- Maintain simplicity in descriptions. The image must be a minimal, hand drawn sketch aesthetic with low detail.
|
||||
- Avoid characters or creatures unless clearly described.
|
||||
- Avoid referencing rendering style, color technique, camera effects, or drawing medium — focus only on the visual content of the scene.
|
||||
- Describe a sparse scene with a single focal point or area.
|
||||
- Use only 3-5 key descriptive phrases or tags.
|
||||
- The entire output should be very short, 20-50 words maximum.
|
||||
- Do NOT repeat wording from the input.
|
||||
- Focus only on visual content, not style, medium, or camera effects.
|
||||
- Avoid describing fine details; focus on large forms and the overall impression.
|
||||
- Do NOT include phrases like “an image of” or “a scene showing”.
|
||||
|
||||
Input:
|
||||
@@ -52,7 +51,7 @@ function buildComfyWorkflow(promptText, negativeText = "") {
|
||||
"inputs": {
|
||||
"seed": Math.floor(Math.random() * 100000),
|
||||
"steps": 4,
|
||||
"cfg": 1,
|
||||
"cfg": 3,
|
||||
"sampler_name": "euler",
|
||||
"scheduler": "simple",
|
||||
"denoise": 1,
|
||||
@@ -157,7 +156,8 @@ async function downloadImage(filename, localFilename) {
|
||||
|
||||
// 4c. Submit prompt and handle full image pipeline
|
||||
async function generateImageViaComfyUI(prompt, filename) {
|
||||
const workflow = buildComfyWorkflow(prompt, "photorealism, hyper-realistic, high detail, 3D render, CGI, ray tracing, glossy, polished, smooth shading, realistic lighting, digital painting, anime, cartoon, pixelated, noisy, cluttered, blurry, sharp focus, symmetrical, perfect perspective, detailed textures, high-resolution textures, high contrast lighting, lens flare, bokeh, camera artifacts, text, logo, signature, watermark, overexposed, underexposed, glowing edges");
|
||||
const negativePrompt = `heavy shading, deep blacks, cross-hatching, dark, gritty, shadow-filled, chiaroscuro, scratchy lines, photorealism, hyper-realistic, high detail, 3D render, CGI, polished, smooth shading, detailed textures, noisy, cluttered, blurry, text, logo, signature, watermark`;
|
||||
const workflow = buildComfyWorkflow(prompt, negativePrompt);
|
||||
|
||||
try {
|
||||
console.log("Submitting prompt to ComfyUI...");
|
||||
|
||||
Reference in New Issue
Block a user