파이썬 코드로 지브리 스튜디오 스타일 이미지 프롬프트를 쉽게 생성하기

 



import tkinter as tk
from tkinter import ttk
import textwrap

# Define elements and their options, tailored for Ghibli style
elements = {
    "Character": ["Human", "Spirit", "Animal", "Robot", "Magical Creature"],
    "Age": ["Child", "Teenager", "Young Adult", "Adult", "Elderly"],
    "Gender": ["Male", "Female", "Non-binary"],
    "Setting": ["Forest", "Village", "City", "Countryside", "Ocean", "Mountains", "Sky", "Fantasy World", "Train Station", "School"],
    "Time of Day": ["Day", "Sunset", "Night", "Golden Hour", "Twilight"],
    "Weather": ["Sunny", "Rainy", "Cloudy", "Windy", "Snowy", "Foggy"],
    "Mood": ["Peaceful", "Melancholy", "Hopeful", "Mysterious", "Whimsical", "Nostalgic", "Serene", "Adventurous", "Contemplative", "Joyful"],
    "Color Palette": ["Warm", "Cool", "Pastel", "Earthy", "Vibrant", "Monochrome", "Soft", "Dreamy"],
    "Art Style": ["Ghibli", "Watercolor", "Oil Painting", "Anime", "Digital Painting", "Sketch"],
    "Lighting": ["Soft", "Natural", "Dramatic", "Ambient", "Golden", "Backlit"],
    "Composition": ["Wide Shot", "Close-up", "Eye-level", "Panoramic", "Symmetrical", "Asymmetrical"],
    "Details": ["Detailed Background", "Intricate Details", "Simple Background", "Minimalist", "Flowing Fabric", "Lush Vegetation"],
    "Emotion": ["Happiness", "Sadness", "Wonder", "Curiosity", "Longing", "Determination", "Peace", "Fear", "Excitement"],
    "Action": ["Walking", "Running", "Flying", "Thinking", "Reading", "Cooking", "Playing", "Exploring", "Dreaming", "Looking"],
    "Clothing": ["Traditional Japanese", "Casual", "Fantasy", "School Uniform", "Simple", "Elegant", "Rustic"],
    "Creature Type": ["Kodama", "Totoro", "Catbus", "Dragon", "Spirit", "Familiar", "Guardian"],
    "Environment Detail": ["Lush Forest", "Quaint Village", "Floating Islands", "Ancient Ruins", "Hidden Waterfall", "Starry Sky"],
    "Focus": ["Character", "Environment", "Storytelling", "Atmosphere", "Emotion"],
    "Camera Angle": ["Low Angle", "High Angle", "Eye Level", "Dutch Angle"],
    "Overall Impression": ["Magical", "Heartwarming", "Nostalgic", "Epic", "Intimate", "Dreamlike"]
}

# Create the main window
root = tk.Tk()
root.title("Ghibli Style Prompt Generator")

# Dictionary to store selected options
selected_options = {}

# Create a frame for the input fields
frame = ttk.Frame(root, padding=10)
frame.pack()

# Create input fields for each element
for element, options in elements.items():
    label = ttk.Label(frame, text=element + ":")
    label.grid(row=len(selected_options), column=0, sticky=tk.W)

    # Create a Combobox (dropdown menu)
    selected_option = tk.StringVar()
    combobox = ttk.Combobox(frame, textvariable=selected_option, values=options, state="readonly")
    combobox.grid(row=len(selected_options), column=1, sticky=tk.W)
    combobox.set(options[0])  # Set a default value

    selected_options[element] = selected_option

# Function to generate the prompt
def generate_prompt():
    prompt_parts = []
    for key, option in selected_options.items():
        prompt_parts.append(f"{key}: {option.get()}")

    prompt = ", ".join(prompt_parts)

    # Wrap the prompt for better readability
    wrapped_prompt = textwrap.fill(prompt, width=80)  # Adjust width as needed

    # Add a Ghibli style prefix to the prompt
    ghibli_prompt = f"Ghibli style, {wrapped_prompt}"

    # Display the prompt in the text box
    prompt_text.delete("1.0", tk.END)  # Clear the text box
    prompt_text.insert(tk.END, ghibli_prompt)

# Create a button to generate the prompt
generate_button = ttk.Button(root, text="Generate Prompt", command=generate_prompt)
generate_button.pack(pady=10)

# Create a text box to display the generated prompt
prompt_text = tk.Text(root, height=10, width=80)
prompt_text.pack()

# Run the main loop
root.mainloop()
@ghibli_prompt_generator.py


파이썬 코드 : 지브리 스타일 프롬프트 생성기. 목록을 선택하고 generate를 클릭하면 프롬프트가 만들어 집니다.



 


Comments