Validate poster dimensions and aspect ratio
(width: float, height: float)
| 141 | |
| 142 | |
| 143 | def validate_poster_dimensions(width: float, height: float) -> tuple[float, float]: |
| 144 | """ |
| 145 | Validate poster dimensions and aspect ratio |
| 146 | """ |
| 147 | if width <= 0 or height <= 0: |
| 148 | raise ValueError(f"Poster dimensions must be positive: {width}x{height}") |
| 149 | |
| 150 | ratio = width / height |
| 151 | # Check poster ratio: lower bound 1.4 (ISO A paper size), upper bound 2 (human vision limit) |
| 152 | if ratio > 2.0 or ratio < 1.4: |
| 153 | raise ValueError( |
| 154 | f"Poster aspect ratio {ratio:.2f} is out of range. " |
| 155 | f"Please use a ratio between 1.4 and 2.0 (width/height)" |
| 156 | ) |
| 157 | |
| 158 | return width, height |
| 159 | |
| 160 | |
| 161 | def create_output_dir(args) -> Path: |