diff --git a/config/templates/A4.svg b/config/templates/A4.svg new file mode 100644 index 0000000..bf0ca19 --- /dev/null +++ b/config/templates/A4.svg @@ -0,0 +1,33 @@ + + + + + + A4 + + + + diff --git a/config/templates/Letter.svg b/config/templates/Letter.svg new file mode 100644 index 0000000..b0010ad --- /dev/null +++ b/config/templates/Letter.svg @@ -0,0 +1,33 @@ + + + + + + Letter + + + + diff --git a/config/templates/Print-CMYK-A4.svg b/config/templates/Print-CMYK-A4.svg new file mode 100644 index 0000000..023eeda --- /dev/null +++ b/config/templates/Print-CMYK-A4.svg @@ -0,0 +1,37 @@ + + + + + + + + + + Print-CMYK-A4 + + + + diff --git a/config/templates/Print-CMYK-Letter.svg b/config/templates/Print-CMYK-Letter.svg new file mode 100644 index 0000000..3fd00ce --- /dev/null +++ b/config/templates/Print-CMYK-Letter.svg @@ -0,0 +1,37 @@ + + + + + + + + + + Print-CMYK-Letter + + + + diff --git a/config/templates/Web-1280x720.svg b/config/templates/Web-1280x720.svg new file mode 100644 index 0000000..feec6cf --- /dev/null +++ b/config/templates/Web-1280x720.svg @@ -0,0 +1,33 @@ + + + + + + Web-1280x720 + + + + diff --git a/config/templates/Web-1920x1080.svg b/config/templates/Web-1920x1080.svg new file mode 100644 index 0000000..3a7512d --- /dev/null +++ b/config/templates/Web-1920x1080.svg @@ -0,0 +1,33 @@ + + + + + + Web-1920x1080 + + + + diff --git a/scripts/gen_templates.py b/scripts/gen_templates.py new file mode 100644 index 0000000..807e77b --- /dev/null +++ b/scripts/gen_templates.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +"""Generate Illuscape document templates.""" +from pathlib import Path + +TEMPLATES_DIR = Path("config/templates") + +def mm_to_px(mm: float) -> float: + return mm * 3.7795275591 # 96 dpi + +def in_to_px(inches: float) -> float: + return inches * 96.0 + +def svg(name: str, width_px: float, height_px: float, + units: str, bleed_mm: float = 0.0, note: str = "") -> str: + import math + bleed_px = mm_to_px(bleed_mm) + guides = "" + if bleed_mm > 0: + guides = f""" + + + + """ + comment = f"" if note else "" + return f""" +{comment} + + {guides} + + {name} + + + + +""" + +specs = [ + ("Letter", in_to_px(8.5), in_to_px(11), "in", 0, "US Letter portrait"), + ("A4", mm_to_px(210), mm_to_px(297), "mm", 0, "A4 portrait"), + ("Web-1920x1080", 1920, 1080, "px", 0, "HD web canvas"), + ("Web-1280x720", 1280, 720, "px", 0, "HD web canvas (smaller)"), + ("Print-CMYK-Letter", in_to_px(8.5), in_to_px(11), "in", 3, "US Letter with 3mm bleed. Note: Inkscape is RGB-native; set CMYK values manually."), + ("Print-CMYK-A4", mm_to_px(210), mm_to_px(297), "mm", 3, "A4 with 3mm bleed. Note: Inkscape is RGB-native; set CMYK values manually."), +] + +for name, w, h, units, bleed, note in specs: + path = TEMPLATES_DIR / f"{name}.svg" + path.write_text(svg(name, w, h, units, bleed, note)) + print(f"✓ {path}")