MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / get_logo_dimensions

Function get_logo_dimensions

utils/logo_utils.py:597–615  ·  view source on GitHub ↗

Calculate logo width to preserve aspect ratio. Args: logo_path: Path to logo image target_height: Desired height in inches Returns: Tuple of (width, height) in inches

(logo_path: str, target_height: float)

Source from the content-addressed store, hash-verified

595
596
597def get_logo_dimensions(logo_path: str, target_height: float) -> Tuple[float, float]:
598 """
599 Calculate logo width to preserve aspect ratio.
600
601 Args:
602 logo_path: Path to logo image
603 target_height: Desired height in inches
604
605 Returns:
606 Tuple of (width, height) in inches
607 """
608 try:
609 with Image.open(logo_path) as img:
610 aspect_ratio = img.width / img.height
611 target_width = target_height * aspect_ratio
612 return target_width, target_height
613 except Exception:
614 # Fallback to square if can't read image
615 return target_height, target_height
616
617
618def add_logos_to_poster_code(

Callers 1

add_logos_to_poster_codeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected