INNER CODE UNIT · Python

find_best_source_image

OpenListTeam/OpenList-Mobile · ios/scripts/generate_ios_icons.py:30

def find_best_source_image(logo_dir, target_size):
    """Find the best source image (closest size >= target size)"""
    available_sizes = [16, 24, 32, 48, 64, 72, 96, 120, 128, 144, 160, 192, 224, 240, 248, 256, 300, 320, 384, 512, 1024]
    
    # Find the smallest size that's >= target size
    for size in available_sizes:
        if size >= target_size:
            source_path = os.path.join(logo_dir, f"{size}x{size}.png")
            if os.path.exists(source_path):
                return source_path
    
    # Fallback to largest available
    return os.path.join(logo_dir, "1024x1024.png")

def generate_icon(source_path, output_path, target_size):
    """Resize and save icon"""
    try:
        img = Image.open(source_path)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…