155 lines
4.6 KiB
PowerShell
155 lines
4.6 KiB
PowerShell
# LS 타라유텍 로고 아이콘 생성 스크립트
|
|
# 간단한 버전 - 텍스트 기반 아이콘
|
|
|
|
Write-Host "LS 타라유텍 앱 아이콘 생성 중..." -ForegroundColor Green
|
|
Write-Host ""
|
|
|
|
# Python 설치 확인
|
|
$python = Get-Command python -ErrorAction SilentlyContinue
|
|
if (-not $python) {
|
|
Write-Host "Python이 설치되지 않았습니다." -ForegroundColor Yellow
|
|
Write-Host "Python을 설치하시겠습니까? (Y/N)" -ForegroundColor Yellow
|
|
$response = Read-Host
|
|
if ($response -eq 'Y' -or $response -eq 'y') {
|
|
Write-Host "Python 설치 중..." -ForegroundColor Green
|
|
choco install python -y
|
|
refreshenv
|
|
} else {
|
|
Write-Host "Python이 필요합니다." -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
# Python 스크립트 생성
|
|
$pythonScript = @"
|
|
from PIL import Image, ImageDraw, ImageFont
|
|
import os
|
|
|
|
# 아이콘 크기
|
|
sizes = {
|
|
'mdpi': 48,
|
|
'hdpi': 72,
|
|
'xhdpi': 96,
|
|
'xxhdpi': 144,
|
|
'xxxhdpi': 192
|
|
}
|
|
|
|
# LS 색상
|
|
ls_blue = (0, 51, 160) # #0033A0
|
|
ls_red = (227, 30, 36) # #E31E24
|
|
|
|
def create_ls_icon(size, round_icon=False):
|
|
# 투명 배경으로 이미지 생성
|
|
img = Image.new('RGBA', (size, size), (255, 255, 255, 0))
|
|
draw = ImageDraw.Draw(img)
|
|
|
|
# 폰트 크기 계산
|
|
font_size = int(size * 0.6)
|
|
|
|
try:
|
|
# 시스템 폰트 사용 시도
|
|
font = ImageFont.truetype("arial.ttf", font_size)
|
|
except:
|
|
try:
|
|
font = ImageFont.truetype("C:/Windows/Fonts/arial.ttf", font_size)
|
|
except:
|
|
# 기본 폰트 사용
|
|
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_size = int(size * 0.08)
|
|
dot_x = size - int(size * 0.25)
|
|
dot_y = int(size * 0.25)
|
|
draw.ellipse([dot_x-dot_size, dot_y-dot_size, dot_x+dot_size, dot_y+dot_size],
|
|
fill=ls_red + (255,))
|
|
|
|
if round_icon:
|
|
# 둥근 마스크 적용
|
|
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
|
|
|
|
return img
|
|
|
|
# 디렉토리 생성
|
|
base_path = 'android/app/src/main/res'
|
|
for density in sizes.keys():
|
|
dir_path = f'{base_path}/mipmap-{density}'
|
|
os.makedirs(dir_path, exist_ok=True)
|
|
|
|
print('아이콘 생성 중...')
|
|
|
|
# 각 크기별 아이콘 생성
|
|
for density, size in sizes.items():
|
|
print(f'생성 중: mipmap-{density} ({size}x{size})')
|
|
|
|
# 일반 아이콘
|
|
icon = create_ls_icon(size, False)
|
|
icon.save(f'{base_path}/mipmap-{density}/ic_launcher.png', 'PNG')
|
|
|
|
# 둥근 아이콘
|
|
round_icon = create_ls_icon(size, True)
|
|
round_icon.save(f'{base_path}/mipmap-{density}/ic_launcher_round.png', 'PNG')
|
|
|
|
print('')
|
|
print('✓ 아이콘 생성 완료!')
|
|
print('')
|
|
print('생성된 파일:')
|
|
for density in sizes.keys():
|
|
print(f' - mipmap-{density}/ic_launcher.png')
|
|
print(f' - mipmap-{density}/ic_launcher_round.png')
|
|
"@
|
|
|
|
# Python 스크립트 저장
|
|
$pythonScript | Out-File -FilePath "create_icons.py" -Encoding UTF8
|
|
|
|
# Pillow 설치
|
|
Write-Host "Pillow 라이브러리 확인 중..." -ForegroundColor Cyan
|
|
python -m pip install --upgrade pip --quiet
|
|
python -m pip install Pillow --quiet
|
|
|
|
# 아이콘 생성 실행
|
|
Write-Host ""
|
|
Write-Host "아이콘 생성 실행 중..." -ForegroundColor Cyan
|
|
python create_icons.py
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host ""
|
|
Write-Host "========================================" -ForegroundColor Green
|
|
Write-Host "✓ LS 타라유텍 아이콘 생성 완료!" -ForegroundColor Green
|
|
Write-Host "========================================" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "다음 명령어로 APK를 빌드하세요:" -ForegroundColor Yellow
|
|
Write-Host " cd android" -ForegroundColor Cyan
|
|
Write-Host " .\gradlew.bat assembleDebug" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# 임시 파일 삭제
|
|
Remove-Item "create_icons.py" -ErrorAction SilentlyContinue
|
|
} else {
|
|
Write-Host ""
|
|
Write-Host "오류가 발생했습니다." -ForegroundColor Red
|
|
Write-Host "수동으로 아이콘을 생성해주세요." -ForegroundColor Yellow
|
|
}
|
|
|