pack resolution no longer does normalize

This commit is contained in:
henryruhs committed 2026-10-06 17:44:57 +02:00
1 parent 3f1fe51be6
commit 7cf0b2d36a
2 files changed
+5 -4

No files matched your search

+4 -3
View File
@@ -67,7 +67,7 @@ def restrict_image_resolution(image_path : str, resolution : Resolution) -> Reso
if is_image(image_path):
image_resolution = detect_image_resolution(image_path)
if image_resolution < resolution:
return image_resolution
return normalize_resolution(image_resolution)
return resolution
@@ -174,7 +174,7 @@ def restrict_video_resolution(video_path : str, resolution : Resolution) -> Reso
if is_video(video_path):
video_resolution = detect_video_resolution(video_path)
if video_resolution < resolution:
return video_resolution
return normalize_resolution(video_resolution)
return resolution
@@ -190,12 +190,13 @@ def normalize_resolution(resolution : Tuple[float, float]) -> Resolution:
if width > 0 and height > 0:
normalize_width = round(width / 2) * 2
normalize_height = round(height / 2) * 2
return normalize_width, normalize_height
return 0, 0
def pack_resolution(resolution : Resolution) -> str:
width, height = normalize_resolution(resolution)
width, height = resolution
return str(width) + 'x' + str(height)
+1 -1
View File
@@ -233,7 +233,7 @@ def test_normalize_resolution() -> None:
def test_pack_resolution() -> None:
assert pack_resolution((1, 1)) == '0x0'
assert pack_resolution((1, 1)) == '1x1'
assert pack_resolution((2, 2)) == '2x2'