133 lines
3.5 KiB
Python
133 lines
3.5 KiB
Python
from PIL import Image, ImageDraw, ImageFont
|
|
import os
|
|
|
|
# LS 티라유텍 브랜드 컬러
|
|
LS_BLUE = (0, 51, 160) # #0033A0
|
|
LS_RED = (227, 30, 36) # #E31E24
|
|
WHITE = (255, 255, 255, 0) # 투명
|
|
|
|
def create_ls_logo(size):
|
|
"""LS 티라유텍 로고를 그립니다"""
|
|
# 투명 배경 이미지 생성
|
|
img = Image.new('RGBA', (size, size), WHITE)
|
|
draw = ImageDraw.Draw(img)
|
|
|
|
# 폰트 크기 계산
|
|
font_size = int(size * 0.45)
|
|
|
|
# 폰트 로드 시도
|
|
font = None
|
|
font_paths = [
|
|
"C:/Windows/Fonts/arialbd.ttf", # Arial Bold
|
|
"C:/Windows/Fonts/arial.ttf", # Arial
|
|
"/System/Library/Fonts/Helvetica.ttc", # Mac
|
|
"/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf" # Linux
|
|
]
|
|
|
|
for font_path in font_paths:
|
|
try:
|
|
font = ImageFont.truetype(font_path, font_size)
|
|
break
|
|
except:
|
|
continue
|
|
|
|
if font is None:
|
|
font = ImageFont.load_default()
|
|
|
|
# LS 텍스트 그리기
|
|
text = "LS"
|
|
|
|
# 텍스트 바운딩 박스 계산
|
|
bbox = draw.textbbox((0, 0), text, font=font)
|
|
text_width = bbox[2] - bbox[0]
|
|
text_height = bbox[3] - bbox[1]
|
|
|
|
# 중앙 위치 계산 (약간 위로)
|
|
x = (size - text_width) // 2
|
|
y = (size - text_height) // 2 - int(size * 0.05)
|
|
|
|
# LS 텍스트 그리기 (파란색, 굵게)
|
|
draw.text((x, y), text, fill=LS_BLUE + (255,), font=font)
|
|
|
|
# 빨간 포인트 추가 (우측 상단)
|
|
dot_radius = int(size * 0.06)
|
|
dot_x = x + text_width + int(size * 0.08)
|
|
dot_y = y + int(size * 0.1)
|
|
|
|
draw.ellipse(
|
|
[dot_x - dot_radius, dot_y - dot_radius,
|
|
dot_x + dot_radius, dot_y + dot_radius],
|
|
fill=LS_RED + (255,)
|
|
)
|
|
|
|
return img
|
|
|
|
def create_round_icon(img):
|
|
"""둥근 아이콘 생성"""
|
|
size = img.size[0]
|
|
|
|
# 둥근 마스크 생성
|
|
mask = Image.new('L', (size, size), 0)
|
|
mask_draw = ImageDraw.Draw(mask)
|
|
mask_draw.ellipse([0, 0, size, size], fill=255)
|
|
|
|
# 마스크 적용
|
|
output = Image.new('RGBA', (size, size), (255, 255, 255, 0))
|
|
output.paste(img, (0, 0))
|
|
output.putalpha(mask)
|
|
|
|
return output
|
|
|
|
# 아이콘 크기 정의
|
|
sizes = {
|
|
'mdpi': 48,
|
|
'hdpi': 72,
|
|
'xhdpi': 96,
|
|
'xxhdpi': 144,
|
|
'xxxhdpi': 192
|
|
}
|
|
|
|
# 디렉토리 생성
|
|
base_path = 'android/app/src/main/res'
|
|
print('디렉토리 생성 중...')
|
|
for density in sizes.keys():
|
|
dir_path = f'{base_path}/mipmap-{density}'
|
|
os.makedirs(dir_path, exist_ok=True)
|
|
|
|
print('')
|
|
print('LS 티라유텍 로고 아이콘 생성 중...')
|
|
print('')
|
|
|
|
# 각 크기별 아이콘 생성
|
|
for density, size in sizes.items():
|
|
print(f'생성 중: mipmap-{density} ({size}x{size})')
|
|
|
|
# 로고 생성
|
|
logo = create_ls_logo(size)
|
|
|
|
# 일반 아이콘 저장
|
|
logo.save(f'{base_path}/mipmap-{density}/ic_launcher.png', 'PNG')
|
|
|
|
# 둥근 아이콘 생성 및 저장
|
|
round_logo = create_round_icon(logo)
|
|
round_logo.save(f'{base_path}/mipmap-{density}/ic_launcher_round.png', 'PNG')
|
|
|
|
print('')
|
|
print('=' * 50)
|
|
print('✓ LS 티라유텍 로고 아이콘 생성 완료!')
|
|
print('=' * 50)
|
|
print('')
|
|
print('생성된 파일:')
|
|
for density in sizes.keys():
|
|
print(f' ✓ mipmap-{density}/ic_launcher.png')
|
|
print(f' ✓ mipmap-{density}/ic_launcher_round.png')
|
|
|
|
print('')
|
|
print('다음 단계:')
|
|
print(' 1. Java 환경 변수 설정 (JAVA_HOME)')
|
|
print(' 2. cd android')
|
|
print(' 3. .\\gradlew.bat assembleDebug')
|
|
|
|
|
|
|