Compute the higher render resolution that preserves aspect ratio.
(width: int, height: int, reference_short_side: int)
| 187 | |
| 188 | |
| 189 | def _render_resolution(width: int, height: int, reference_short_side: int): |
| 190 | """Compute the higher render resolution that preserves aspect ratio.""" |
| 191 | if height <= width: |
| 192 | rw = int(width * reference_short_side / height) |
| 193 | rh = reference_short_side |
| 194 | else: |
| 195 | rw = reference_short_side |
| 196 | rh = int(height * reference_short_side / width) |
| 197 | scale_x = rw / width |
| 198 | scale_y = rh / height |
| 199 | return rw, rh, scale_x, scale_y |
| 200 | |
| 201 | |
| 202 | _MIN_RADIUS = 2 |