Files
DTGAPK/create-icons.ps1

75 lines
2.3 KiB
PowerShell

# 앱 아이콘 생성 스크립트
# 사용법: .\create-icons.ps1 logo.png
param(
[Parameter(Mandatory=$true)]
[string]$LogoPath
)
if (-not (Test-Path $LogoPath)) {
Write-Host "오류: 로고 파일을 찾을 수 없습니다: $LogoPath" -ForegroundColor Red
exit 1
}
# ImageMagick 설치 확인
$magick = Get-Command magick -ErrorAction SilentlyContinue
if (-not $magick) {
Write-Host "ImageMagick이 설치되지 않았습니다." -ForegroundColor Yellow
Write-Host "설치하시겠습니까? (Y/N)" -ForegroundColor Yellow
$response = Read-Host
if ($response -eq 'Y' -or $response -eq 'y') {
Write-Host "ImageMagick 설치 중..." -ForegroundColor Green
choco install imagemagick -y
} else {
Write-Host "ImageMagick이 필요합니다. 수동으로 설치해주세요." -ForegroundColor Red
Write-Host "다운로드: https://imagemagick.org/script/download.php" -ForegroundColor Yellow
exit 1
}
}
Write-Host "앱 아이콘 생성 중..." -ForegroundColor Green
$sizes = @{
"mdpi" = 48
"hdpi" = 72
"xhdpi" = 96
"xxhdpi" = 144
"xxxhdpi" = 192
}
foreach ($density in $sizes.Keys) {
$size = $sizes[$density]
$dir = "android\app\src\main\res\mipmap-$density"
# 디렉토리 생성
if (-not (Test-Path $dir)) {
New-Item -ItemType Directory -Path $dir -Force | Out-Null
}
Write-Host "생성 중: mipmap-$density ($size x $size)" -ForegroundColor Cyan
# ic_launcher.png
magick $LogoPath -resize "${size}x${size}" "$dir\ic_launcher.png"
# ic_launcher_round.png (둥근 모서리)
magick $LogoPath -resize "${size}x${size}" `
-alpha set `
"(" -clone 0 -draw "roundrectangle 0,0,$size,$size,$(($size/8)),$(($size/8))" ")" `
-compose DstIn -composite `
"$dir\ic_launcher_round.png"
}
Write-Host ""
Write-Host "✓ 앱 아이콘 생성 완료!" -ForegroundColor Green
Write-Host ""
Write-Host "생성된 파일:" -ForegroundColor Yellow
Get-ChildItem "android\app\src\main\res\mipmap-*\ic_launcher*.png" | ForEach-Object {
Write-Host " - $($_.FullName)" -ForegroundColor Gray
}
Write-Host ""
Write-Host "다음 명령어로 APK를 빌드하세요:" -ForegroundColor Yellow
Write-Host " cd android" -ForegroundColor Cyan
Write-Host " .\gradlew.bat assembleDebug" -ForegroundColor Cyan