INNER CODE UNIT · Python
generate_icon
OpenListTeam/OpenList-Mobile · ios/scripts/generate_ios_icons.py:44
def generate_icon(source_path, output_path, target_size):
"""Resize and save icon"""
try:
img = Image.open(source_path)
img = img.resize((target_size, target_size), Image.Resampling.LANCZOS)
img.save(output_path, "PNG", optimize=True)
print(f"✓ Generated: {os.path.basename(output_path)} ({target_size}x{target_size})")
return True
except Exception as e:
print(f"✗ Failed to generate {os.path.basename(output_path)}: {e}")
return False
def main():
# Paths
script_dir = os.path.dirname(os.path.abspath(__file__))
ios_dir = os.path.dirname(script_dir)
flutter_project_root = os.path.dirname(ios_dir)
workspace_root = os.path.dirname(flutter_project_root)