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)
| 595 | |
| 596 | |
| 597 | def 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 | |
| 618 | def add_logos_to_poster_code( |
no outgoing calls
no test coverage detected