- 📱 PWA 지원: 홈화면 추가 가능한 Progressive Web App - 🎨 M-Project 색상 스키마: 하늘색, 주황색, 회색, 흰색 일관된 디자인 - 📊 대시보드: 데스크톱 캘린더 뷰 + 모바일 일일 뷰 반응형 디자인 - 📥 분류 센터: Gmail 스타일 받은편지함으로 스마트 분류 시스템 - 🤖 AI 분류 제안: 키워드 기반 자동 분류 제안 및 일괄 처리 - 📷 업로드 모달: 데스크톱(파일 선택) + 모바일(카메라/갤러리) 최적화 - 🏷️ 3가지 분류: Todo(시작일), 캘린더(마감일), 체크리스트(무기한) - 📋 체크리스트: 진행률 표시 및 완료 토글 기능 - 🔄 시놀로지 연동 준비: 메일플러스 연동을 위한 구조 설계 - 📱 반응형 UI: 모든 페이지 모바일 최적화 완료
114 lines
4.0 KiB
Python
114 lines
4.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
PWA 아이콘 생성 스크립트
|
|
원본 이미지를 다양한 크기의 아이콘으로 변환
|
|
"""
|
|
|
|
from PIL import Image, ImageDraw, ImageFilter
|
|
import os
|
|
|
|
def create_rounded_icon(image, size, corner_radius=None):
|
|
"""둥근 모서리 아이콘 생성"""
|
|
if corner_radius is None:
|
|
corner_radius = size // 8 # 기본값: 크기의 1/8
|
|
|
|
# 이미지 리사이즈
|
|
img = image.resize((size, size), Image.Resampling.LANCZOS)
|
|
|
|
# 마스크 생성 (둥근 사각형)
|
|
mask = Image.new('L', (size, size), 0)
|
|
draw = ImageDraw.Draw(mask)
|
|
draw.rounded_rectangle([0, 0, size, size], corner_radius, fill=255)
|
|
|
|
# 마스크 적용
|
|
result = Image.new('RGBA', (size, size), (0, 0, 0, 0))
|
|
result.paste(img, (0, 0))
|
|
result.putalpha(mask)
|
|
|
|
return result
|
|
|
|
def main():
|
|
# 원본 이미지 로드
|
|
source_image = "DSCF0333.RAF_compressed.JPEG"
|
|
if not os.path.exists(source_image):
|
|
print(f"❌ 원본 이미지를 찾을 수 없습니다: {source_image}")
|
|
return
|
|
|
|
try:
|
|
with Image.open(source_image) as img:
|
|
# RGB로 변환 (RGBA가 아닌 경우)
|
|
if img.mode != 'RGB':
|
|
img = img.convert('RGB')
|
|
|
|
# 정사각형으로 크롭 (중앙 기준)
|
|
width, height = img.size
|
|
size = min(width, height)
|
|
left = (width - size) // 2
|
|
top = (height - size) // 2
|
|
img = img.crop((left, top, left + size, top + size))
|
|
|
|
# 아이콘 크기 목록
|
|
icon_sizes = [
|
|
(72, "icon-72x72.png"),
|
|
(96, "icon-96x96.png"),
|
|
(128, "icon-128x128.png"),
|
|
(144, "icon-144x144.png"),
|
|
(152, "icon-152x152.png"),
|
|
(192, "icon-192x192.png"),
|
|
(384, "icon-384x384.png"),
|
|
(512, "icon-512x512.png")
|
|
]
|
|
|
|
# Apple Touch Icon (둥근 모서리 없음)
|
|
apple_sizes = [
|
|
(180, "apple-touch-icon.png"),
|
|
(167, "apple-touch-icon-ipad.png")
|
|
]
|
|
|
|
# 아이콘 디렉토리 생성
|
|
icons_dir = "frontend/static/icons"
|
|
os.makedirs(icons_dir, exist_ok=True)
|
|
|
|
print("🎨 PWA 아이콘 생성 중...")
|
|
|
|
# PWA 아이콘 생성 (둥근 모서리)
|
|
for size, filename in icon_sizes:
|
|
icon = create_rounded_icon(img, size)
|
|
icon_path = os.path.join(icons_dir, filename)
|
|
icon.save(icon_path, "PNG", optimize=True)
|
|
print(f"✅ {filename} ({size}x{size})")
|
|
|
|
# Apple Touch Icon 생성 (둥근 모서리 없음)
|
|
for size, filename in apple_sizes:
|
|
icon = img.resize((size, size), Image.Resampling.LANCZOS)
|
|
icon_path = os.path.join(icons_dir, filename)
|
|
icon.save(icon_path, "PNG", optimize=True)
|
|
print(f"✅ {filename} ({size}x{size})")
|
|
|
|
# 파비콘 생성
|
|
favicon_sizes = [(16, 16), (32, 32), (48, 48)]
|
|
favicon_images = []
|
|
|
|
for size, _ in favicon_sizes:
|
|
favicon = img.resize((size, size), Image.Resampling.LANCZOS)
|
|
favicon_images.append(favicon)
|
|
|
|
# 멀티 사이즈 favicon.ico 생성
|
|
favicon_path = "frontend/favicon.ico"
|
|
favicon_images[0].save(
|
|
favicon_path,
|
|
format='ICO',
|
|
sizes=[(16, 16), (32, 32), (48, 48)],
|
|
append_images=favicon_images[1:]
|
|
)
|
|
print(f"✅ favicon.ico (16x16, 32x32, 48x48)")
|
|
|
|
print(f"\n🎉 총 {len(icon_sizes) + len(apple_sizes) + 1}개의 아이콘이 생성되었습니다!")
|
|
print(f"📁 아이콘 위치: {icons_dir}/")
|
|
|
|
except Exception as e:
|
|
print(f"❌ 아이콘 생성 실패: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|