MCPcopy Create free account
hub / github.com/OpenDCAI/Paper2Any / validate_poster_dimensions

Function validate_poster_dimensions

script/run_paper2poster_cli.py:143–158  ·  view source on GitHub ↗

Validate poster dimensions and aspect ratio

(width: float, height: float)

Source from the content-addressed store, hash-verified

141
142
143def 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
161def create_output_dir(args) -> Path:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected