Files
DTGAPK/create-ls-icons-simple.ps1

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
}