half-drop-demo / experiments /diamond-crop-img2img.py
Sean Powell
Tweak params and prompts for diamond-crop-img2img.
22facc4
from utils import tiling, pipes, filenames, images, wallpaper
prompt = "seamless pattern of parrots. black and white, drawing, white background, seamless, ornament."
desired_output_width = 1024
inference_steps = 25
img2img_strength = 0.5
generation_dir = "./generations/diamond_crop_img2img"
sdxl_pipe = pipes.create_stable_diffusion_xl_pipeline()
sdxl_img2img_pipe = pipes.create_stable_diffusion_xl_img2img_pipe()
# Sources:
# - https://aituts.com/midjourney-tile/
prompts = [
"illuminant gold roses repeated pattern flat on a rich bright read paper:: deep colors, stunning palette, intricate details, ornate, detailed illustration, octane render, impressive shadows :: Johanna Rupprecht style, William Morris style",
"illuminant bronze keys repeated pattern flat on a rich bright read paper:: deep colors, stunning palette, intricate details, ornate, detailed illustration, octane render, impressive shadows :: Johanna Rupprecht style, William Morris style",
"repeating pattern prayer watercolor, white background, in the style of Rory McEwen, centered on the frame, single leaf",
"pattern sago palm watercolor, white background, in the style of Rory McEwen, centered on the frame, single leaf",
"botanical art, watercolor, white background, no background, in the style of Pandora Sellars",
"Clip Art cityscape, vibrant colors and geometric patterns, a yellow background, designed by Herge, lava glow, Low angle",
"Craft a 4K visual masterpiece that envisions a surreal quantum garden, where reality blurs with the fantastical. Explore vibrant colors, fractal patterns, and intricate details to create a mesmerizing tapestry of interconnected dimensions. Let the scene evoke a sense of wonder and mystery as viewers explore the boundaries between the tangible and the ethereal",
"vibrant color grading, long exposure, bokeh, dramatic angle, extreme angle shot, horror, sci-fi",
]
for prompt in prompts:
print(f"using prompt: `{prompt}`")
original_image_size = tiling.compute_input_tile_width_for_desired_output(desired_output_width)
original_image = sdxl_pipe(prompt=prompt, num_inference_steps=inference_steps, width=original_image_size,
height=original_image_size).images[0]
original_image_filename = filenames.generate_filename(f"{generation_dir}/originals", prompt)
original_image.save(original_image_filename)
print("generated original image", original_image_filename)
inner_rotated_tile = images.extract_inner_rotated_tile_from_image(original_image)
inner_rotated_tile_filename = filenames.generate_filename(f"{generation_dir}/inner_rotated_tiles", prompt,
"-inner-rotated")
inner_rotated_tile.save(inner_rotated_tile_filename)
print("generated inner rotated tile", inner_rotated_tile_filename)
tileable_image = \
sdxl_img2img_pipe(prompt, image=inner_rotated_tile.convert("RGB"), num_inference_steps=inference_steps,
strength=img2img_strength).images[
0]
tileable_image_filename = filenames.generate_filename(f"{generation_dir}/tiles", prompt, "-tile")
tileable_image.save(tileable_image_filename)
print("generated tileable image", tileable_image_filename)
half_drop = wallpaper.convert_tile_to_half_drop(tileable_image)
half_drop_filename = filenames.generate_filename(f"{generation_dir}/half_drops", prompt, "_half-drop-tile")
half_drop.save(half_drop_filename)
print("generated half drop tile", tileable_image_filename)
half_drop_demo = wallpaper.generate_tile_test_arrangement(half_drop)
half_drop_demo_filename = filenames.generate_filename(f"{generation_dir}/half_drop_demos", prompt,
"_half-drop-demo")
half_drop_demo.save(half_drop_demo_filename)
print("generated half drop demo", tileable_image_filename)