#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ CIP HTML Presentation Renderer Generates a professional HTML presentation from CIP mockup images with detailed descriptions, concepts, and brand guidelines. """ import argparse import json import os import sys import base64 from pathlib import Path from datetime import datetime # Add parent directory for imports sys.path.insert(0, str(Path(__file__).parent)) from core import search, get_cip_brief # Deliverable descriptions for presentation DELIVERABLE_INFO = { "business card": { "title": "Business Card", "concept": "First impression touchpoint for professional networking", "purpose": "Creates memorable brand recall during business exchanges", "specs": "Standard 3.5 x 2 inches, premium paper stock" }, "letterhead": { "title": "Letterhead", "concept": "Official correspondence identity", "purpose": "Establishes credibility and professionalism in written communications", "specs": "A4/Letter size, digital and print versions" }, "document template": { "title": "Document Template", "concept": "Branded document system for internal and external use", "purpose": "Ensures consistent brand representation across all documents", "specs": "Multiple formats: Word, PDF, Google Docs compatible" }, "reception signage": { "title": "Reception Signage", "concept": "Brand presence in physical office environment", "purpose": "Creates strong first impression for visitors and reinforces brand identity", "specs": "3D dimensional letters, backlit LED options, premium materials" }, "office signage": { "title": "Office Signage", "concept": "Wayfinding and brand presence system", "purpose": "Guides visitors while maintaining consistent brand experience", "specs": "Modular system with directional and informational signs" }, "polo shirt": { "title": "Polo Shirt", "concept": "Professional team apparel", "purpose": "Creates unified team identity and brand ambassadorship", "specs": "Premium pique cotton, embroidered logo on left chest" }, "t-shirt": { "title": "T-Shirt", "concept": "Casual brand apparel", "purpose": "Extends brand reach through everyday wear and promotional events", "specs": "High-quality cotton, screen print or embroidery options" }, "vehicle": { "title": "Vehicle Branding", "concept": "Mobile brand advertising", "purpose": "Transforms fleet into moving billboards for maximum visibility", "specs": "Partial or full wrap, vinyl graphics, weather-resistant" }, "van": { "title": "Van Branding", "concept": "Commercial vehicle identity", "purpose": "Professional fleet presence for service and delivery operations", "specs": "Full wrap design, high-visibility contact information" }, "car": { "title": "Car Branding", "concept": "Executive vehicle identity", "purpose": "Professional presence for corporate and sales teams", "specs": "Subtle branding, door panels and rear window" }, "envelope": { "title": "Envelope", "concept": "Branded mail correspondence", "purpose": "Extends brand identity to all outgoing mail", "specs": "DL, C4, C5 sizes with logo placement" }, "folder": { "title": "Presentation Folder", "concept": "Document organization with brand identity", "purpose": "Professional presentation of proposals and materials", "specs": "A4/Letter pocket folder with die-cut design" } } def get_image_base64(image_path): """Convert image to base64 for embedding in HTML""" try: with open(image_path, "rb") as f: return base64.b64encode(f.read()).decode('utf-8') except Exception as e: print(f"Warning: Could not load image {image_path}: {e}") return None def get_deliverable_info(filename): """Extract deliverable type from filename and get info""" filename_lower = filename.lower() for key, info in DELIVERABLE_INFO.items(): if key.replace(" ", "-") in filename_lower or key.replace(" ", "_") in filename_lower: return info # Default info return { "title": filename.replace("-", " ").replace("_", " ").title(), "concept": "Brand identity application", "purpose": "Extends brand presence across touchpoints", "specs": "Custom specifications" } def generate_html(brand_name, industry, images_dir, output_path=None, style=None): """Generate HTML presentation from CIP images""" images_dir = Path(images_dir) if not images_dir.exists(): print(f"Error: Directory not found: {images_dir}") return None # Get all PNG images images = sorted(images_dir.glob("*.png")) if not images: print(f"Error: No PNG images found in {images_dir}") return None # Get CIP brief for brand info brief = get_cip_brief(brand_name, industry, style) style_info = brief.get("style", {}) industry_info = brief.get("industry", {}) # Build HTML html_parts = [f''' {brand_name} - Corporate Identity Program

{brand_name}

Corporate Identity Program

Industry
{industry_info.get("Industry", industry.title())}
Style
{style_info.get("Style Name", "Corporate")}
Mood
{style_info.get("Mood", "Professional")}
Deliverables
{len(images)} Items

Brand Applications

Comprehensive identity system designed to maintain consistency across all brand touchpoints and communications.

'''] # Add each deliverable for i, image_path in enumerate(images): info = get_deliverable_info(image_path.stem) img_base64 = get_image_base64(image_path) if img_base64: img_src = f"data:image/png;base64,{img_base64}" else: img_src = str(image_path) html_parts.append(f'''
{info['title']}

{info['title']}

{info['concept']}

{info['purpose']}

{info['specs']}
''') # Close HTML html_parts.append(f'''
''') html_content = "".join(html_parts) # Save HTML output_path = output_path or images_dir / f"{brand_name.lower().replace(' ', '-')}-cip-presentation.html" output_path = Path(output_path) with open(output_path, "w", encoding="utf-8") as f: f.write(html_content) print(f"✅ HTML presentation generated: {output_path}") return str(output_path) def main(): parser = argparse.ArgumentParser( description="Generate HTML presentation from CIP mockups", formatter_class=argparse.RawDescriptionHelpFormatter, epilog=""" Examples: # Generate HTML from CIP images directory python render-html.py --brand "TopGroup" --industry "consulting" --images ./topgroup-cip # Specify output path python render-html.py --brand "TopGroup" --industry "consulting" --images ./cip --output presentation.html """ ) parser.add_argument("--brand", "-b", required=True, help="Brand name") parser.add_argument("--industry", "-i", default="technology", help="Industry type") parser.add_argument("--style", "-s", help="Design style") parser.add_argument("--images", required=True, help="Directory containing CIP mockup images") parser.add_argument("--output", "-o", help="Output HTML file path") args = parser.parse_args() generate_html( brand_name=args.brand, industry=args.industry, images_dir=args.images, output_path=args.output, style=args.style ) if __name__ == "__main__": main()