zioinfo-mail/scripts/misc/make_dark_logo.py
DESKTOP-TKLFCPR\ython 28d3ba4836 refactor(cleanup): commit folder reorganization - scripts/, _archive/, docs/ restructure
- Move backend/frontend/messenger/ old paths to _archive/
- Reorganize scripts into scripts/deploy, check, push, setup, misc
- Move docs (pptx, docx) to docs/
- Add .claude agents and skills for fullstack/folder-cleanup harness
- workspace/ projects remain intact

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-01 19:43:09 +09:00

54 lines
1.7 KiB
Python

"""
로고 다크 배경용 버전 생성
- 글자 픽셀 (어두운 색상) → 흰색
- 로고 마크 (파랑/회색 기하학적 도형) → 유지
"""
from PIL import Image
import numpy as np
src = Image.open(r'C:\GUARDiA\logo\지오정보기술로고.png').convert('RGBA')
arr = np.array(src, dtype=np.float32)
R, G, B, A = arr[:,:,0], arr[:,:,1], arr[:,:,2], arr[:,:,3]
# 글자 픽셀 조건:
# 1. 불투명(alpha > 30)
# 2. 어두운 색 (밝기 < 120)
# 3. 채도가 낮음 (R≈G≈B) → 검정/회색계열
# 4. OR 진한 네이비/다크블루 (B > R, G 이지만 전체 어두움)
luminance = (R * 0.299 + G * 0.587 + B * 0.114)
# 조건: 알파 > 30이고 밝기 < 100인 픽셀 → 글자로 판단
is_text = (A > 30) & (luminance < 100)
# 추가: 진한 파란 글자 (ZIO INFOTECH - 어두운 파랑)
# R<80, G<80, B<180 이면서 B가 R, G보다 높은 경우
is_dark_blue_text = (A > 30) & (R < 80) & (G < 80) & (B < 180)
mask = is_text | is_dark_blue_text
# 글자 픽셀을 흰색으로
result = arr.copy()
result[mask, 0] = 255 # R
result[mask, 1] = 255 # G
result[mask, 2] = 255 # B
# Alpha는 유지
out = Image.fromarray(result.astype(np.uint8), 'RGBA')
# 저장
out_path = r'C:\GUARDiA\workspace\zioinfo-web\frontend\public\zioinfo-logo-dark.png'
out.save(out_path, 'PNG')
print(f'저장: {out_path}')
# 미리보기 썸네일
thumb = out.copy()
thumb.thumbnail((400, 400))
# 다크 배경에서 확인용 (배경 합성)
bg = Image.new('RGBA', thumb.size, (26, 26, 46, 255))
bg.paste(thumb, mask=thumb.split()[3])
bg.save(r'C:\GUARDiA\logo\logo_dark_preview.png')
print('미리보기 저장: logo_dark_preview.png')
print(f'변환된 픽셀 수: {mask.sum():,}')