[SCRIPT] Updated

This commit is contained in:
t
2025-03-31 20:14:11 +02:00
parent 810f54cb65
commit 314a27eb42
472 changed files with 11721 additions and 921 deletions
@@ -0,0 +1,18 @@
import math
def rgba_to_hex(rgba: list) -> str:
return "#{:02x}{:02x}{:02x}".format(*rgba)
def calculate_optimal_size(width: int, height: int, bitmap_size: int) -> tuple:
image_area = width * height
bitmap_area = bitmap_size**2
scale = math.sqrt(bitmap_area / image_area) if image_area > bitmap_area else 1
new_width = round(width * scale)
new_height = round(height * scale)
if new_width == 0:
new_width = 1
if new_height == 0:
new_height = 1
return new_width, new_height