diff options
Diffstat (limited to 'wallpaper.py')
| -rwxr-xr-x | wallpaper.py | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/wallpaper.py b/wallpaper.py index 9cd0c2f..3972f0e 100755 --- a/wallpaper.py +++ b/wallpaper.py @@ -340,16 +340,25 @@ def step_upscale( def step_save( - images: list[Any], output_dir: Path, now: dt.datetime, prompt_text: str + upscaled: list[Any], + raw_images: list[Any], + output_dir: Path, + now: dt.datetime, + prompt_text: str, ) -> list[Path]: output_dir.mkdir(parents=True, exist_ok=True) saved = [] tag = now.strftime("%Y%m%d-%H%M%S") - for i, img in enumerate(images): - fname = f"wallpaper-{tag}" + (f"-{i}" if len(images) > 1 else "") + ".jpg" - path = output_dir / fname - img.save(path, "JPEG", quality=95) - saved.append(path) + for i, (up, raw) in enumerate(zip(upscaled, raw_images)): + idx = f"-{i}" if len(upscaled) > 1 else "" + for img, fname in ( + (up, f"wallpaper-{tag}{idx}.jpg"), + (raw, f"raw-{tag}{idx}.jpg"), + ): + path = output_dir / fname + img.save(path, "JPEG", quality=100) + if fname.startswith("wall"): + saved.append(path) txt_path = output_dir / f"prompt-{tag}.txt" txt_path.write_text(prompt_text) return saved @@ -376,19 +385,19 @@ def parse_args() -> argparse.Namespace: "--taste-prompt", nargs="+", default=[ - "monumental pristine concrete and white stone architecture", + "monumental pristine concrete architecture", "hypermodern flawless surfaces beside weathered ancient ruins", "colossal enigmatic megastructure looming on the horizon", - "long colonnades of square columns", "elevated walkways and straight causeways", "monumental staircases and terraced platforms", "freestanding gates and arched portals", "open plazas and courtyards", - "obelisks and abstract concrete sculptures", + "abstract concrete sculptures", "precise water channels and reflecting pools", "clean geometric forms at impossible scale", "distinct scales of objects, some very large for contrast", "serene, deserted, contemplative", + "completely out of place architecture", ], help="Core aesthetic keywords shared across all biomes.", ) @@ -403,12 +412,11 @@ def parse_args() -> argparse.Namespace: "--biomes", nargs="+", default=[ - "mediterranean coast: sun-bleached stone terraces, azure sea, rocky coastline, cypress and olive trees, warm limestone cliffs, salt haze over the water", - "verdant grassland: rolling green meadows, wildflowers and tall grass, gentle hills to the horizon, scattered broadleaf trees", + "mediterranean: sun-bleached stone terraces, azure sea, rocky coastline, cypress and olive trees, warm limestone cliffs, salt haze over the water", "autumn forest: dense woodland in golden and crimson foliage, fallen leaves, thin mist between trunks, damp moss-streaked surfaces", - "desert canyon: red sandstone canyons and mesas, wind-carved rock, ultra blue shallow water, strata, drifting dunes, dry heat shimmer, deep shadow in narrow ravines", + "desert canyon: red sandstone canyons, wind-carved strange rock shapes, ultra blue shallow water, strata, drifting dunes, dry heat shimmer, deep shadow in narrow ravines", "arctic tundra: snowfields and frozen lakes, sheathing ice, sparse black rock breaking through snow, long blue shadows, frost haze", - "misty wetland: still black water and reed beds, low-hanging fog, half-submerged ground, mirror-flat reflections", + "misty wetland: still black water and reed beds, very subtle low-hanging fog, half-submerged ground, mirror-flat reflections", "volcanic wastes: black basalt plains, drifting ash, cooled lava flows, faint orange fissures, columnar basalt cliffs", "tropical highlands: lush jungle terraces, waterfalls down cliff faces, climbing vines, humid haze, broad-leafed plants", "megastructure interior: vast enclosed halls, endless repeating bays, shafts of light from distant openings, no vegetation", @@ -495,15 +503,14 @@ def parse_args() -> argparse.Namespace: "Given the user's taste and the context, write one detailed text-to-image prompt for a diffusion model. " "You are repeatedly called upon to do this, and must introduce variation into your output. " "The taste reference lists the architectural themes to build on; improvise around them, or drop some. " - "The required biome defines the landscape, vegetation, climate, and colour palette of the scene, " - "and MUST dominate the environment; blend the taste reference's structures into it. " - "The required perspective MUST be used as the camera viewpoint of the image; " - "ground it in the biome's terrain, adapting its details so the combination is physically coherent " - "(an open expanse may be sea, sand, snow, grass, or a vast hall floor depending on the biome). " + "The output must have no recongnisably human objects (pots, people, buildings, vehicles etc). " + "The scene must look fantastical, in the distant future. " + "The focus is about the strange contrast between provided user tastes and the environment. " + "The required biome defines the landscape, vegetation, climate, and colour palette of the scene, and MUST dominate the environment; blend the taste reference's structures into it. " + "The required perspective MUST be used as the camera viewpoint of the image; ground it in the biome's terrain, adapting its details so the combination is physically coherent (an open expanse may be sea, sand, snow, grass, or a vast hall floor depending on the biome). " "Times after sunset and before sunrise should generate dark images for night time. " "Times during the day should track the brightness of the hour. " - "The weather should be reflected in your prompt where it does not contradict the biome; " - "the biome's climate wins any conflict. " + "The weather should be reflected in your prompt where it does not contradict the biome; the biome's climate wins any conflict. " "The season should set the overall mood of the prompt. " "Do not include the time, date, or location in your prompt. " "Output ONLY the image prompt — no explanation or preamble." @@ -642,7 +649,9 @@ def run() -> None: ) # 5. save to configured output directory - saved = step_save(upscaled, Path(args.ephemeral_dir).expanduser(), now, prompt_text) + saved = step_save( + upscaled, raw_images, Path(args.ephemeral_dir).expanduser(), now, prompt_text + ) for p in saved: logger.info("Saved: %s", p.resolve()) |
