import os
from psd_tools import PSDImage
from psd_tools.api.layers import TextLayer
# Function to create a Photoshop template
def create_photoshop_template(output_path, text_content):
"""
Creates a Photoshop template with editable text layers.
:param output_path: Path to save the .psd file.
:param text_content: Text to insert into the template.
"""
# Create a blank PSD image
psd = PSDImage.new((1920, 1080)) # 1920x1080 resolution
# Add a text layer
text_layer = psd.add_layer(TextLayer())
text_layer.text = text_content
text_layer.name = "Editable Text Layer"
text_layer.position = (50, 50) # Position of the text
# Save the PSD file
psd.save(output_path)
print(f"Photoshop template saved at {output_path}")
# Placeholder for After Effects template generation
def create_after_effects_template(output_path, text_content):
"""
Placeholder for creating an After Effects template.
:param output_path: Path to save the .aep file.
:param text_content: Text to insert into the template.
"""
print("After Effects template generation is not implemented yet.")
# This would involve using ExtendScript or aepx library to create .aep files.
# Placeholder for Premiere Pro template generation
def create_premiere_pro_template(output_path, text_content):
"""
Placeholder for creating a Premiere Pro template.
:param output_path: Path to save the .prproj file.
:param text_content: Text to insert into the template.
"""
print("Premiere Pro template generation is not implemented yet.")
# This would involve using ExtendScript or other libraries to create .prproj files.
# Placeholder for Filmora template generation
def create_filmora_template(output_path, text_content):
"""
Placeholder for creating a Filmora template.
:param output_path: Path to save the template file.
:param text_content: Text to insert into the template.
"""
print("Filmora template generation is not implemented yet.")
# This would involve creating XML/JSON structures or manual project files.
# Main function to generate templates
def generate_templates(text_content, output_dir="output"):
"""
Generates templates for Photoshop, After Effects, Premiere Pro, and Filmora.
:param text_content: Text to insert into the templates.
:param output_dir: Directory to save the generated templates.
"""
if not os.path.exists(output_dir):
os.makedirs(output_dir)
# Generate Photoshop template
photoshop_output = os.path.join(output_dir, "template.psd")
create_photoshop_template(photoshop_output, text_content)
# Generate After Effects template
after_effects_output = os.path.join(output_dir, "template.aep")
create_after_effects_template(after_effects_output, text_content)
# Generate Premiere Pro template
premiere_pro_output = os.path.join(output_dir, "template.prproj")
create_premiere_pro_template(premiere_pro_output, text_content)
# Generate Filmora template
filmora_output = os.path.join(output_dir, "template.filmora")
create_filmora_template(filmora_output, text_content)
# Example usage
if __name__ == "__main__":
user_input_text = input("Enter the text you want in the templates: ")
generate_templates(user_input_text)