html-thumbnail-maker/SKILL.md
HTML/CSS 썸네일 및 OG 제작
글 제목과 부제를 입력하면 웹 브라우저에서 바로 캡처하거나 렌더링할 수 있는 규격별 HTML/CSS 썸네일과 OG 이미지 코드를 생성합니다. 여백 비율과 대비 기준이 SKILL.md에 정리되어 있으며 생성된 결과 예시를 상세 페이지에서 확인합니다.
SKILL.md 지시문 전문151줄
---name: html-thumbnail-makerdescription: HTML/CSS 한 장으로 썸네일·OG 이미지(1200×630, 1200×600)를 그리고 헤드리스 크롬으로 PNG를 찍는 스킬. 구도 공식(제목 주인공형/사물 주인공형), 한글 제목 두 줄 덩어리, 320px 축소 가독성, 카카오톡 2:1 미리보기 대응(핵심은 중앙 80%), 여백 균형·요소 겹침 점검, 사물 5~15도 기울이기를 적용하고 scripts/shot.py로 찍기와 배치 검사를 한다. 사용자가 "썸네일 만들어 줘", "OG 이미지", "대표 이미지", "블로그 썸네일", "공유할 때 뜨는 이미지", "링크 미리보기 이미지", "카톡 공유 이미지", "og:image", "유튜브·뉴스레터 커버를 HTML로" 같은 요청을 하거나, 글·페이지 제목을 주며 이미지 한 장을 원할 때 반드시 이 스킬을 쓴다. 이미지 생성 모델이 없거나 한글 글자가 정확해야 하는 이미지에 특히 맞다.compatibility: 크롬·크로미움·엣지 중 하나와 파이썬 3이 설치된 환경(코드 실행 가능)--- # HTML 썸네일 메이커 썸네일은 **작게 보인다.** 메신저 대화창에서 폭 320px 안팎, 검색 결과에서는 더 작다. 1200px 화면에서 보기 좋게 만든 이미지가 실제로는 글자가 뭉개진 얼룩이 되는 것이 가장 흔한 실패다. 그래서 이 스킬은 "예쁘게 그리기"보다 **작아졌을 때 제목이 읽히는가, 잘렸을 때 핵심이 남는가**를 숫자와 축소본으로 확인하는 절차에 무게를 둔다. HTML로 그리는 이유: 한글 글자가 정확하고, 수정이 숫자 하나로 끝나며, 요소의 실제 좌표를 읽어 겹침·쏠림을 기계로 검사할 수 있다. ## 작업 순서 1. 크기와 구도 정하기 → 2. 제목 두 줄 덩어리 만들기 → 3. HTML 작성 → 4. 찍기 + 배치 검사 → 5. 확인판을 눈으로 보기 → 6. 고쳐서 다시(4~5 반복) → 7. 납품 4~5를 건너뛰고 "만들었습니다"라고 하지 않는다. 찍은 이미지를 직접 열어 본 뒤에만 끝낸다. ## 1. 크기와 구도 **크기**: 따로 지정이 없으면 1200×630(OG 표준). 2:1이 필요한 곳(일부 SNS 카드, 2:1 지정 요청)은 1200×600. 어느 쪽이든 아래 "중앙 80%" 규칙을 지키면 서로 잘려도 살아남는다. **구도는 둘 중 하나.** 섞지 않는다. | | 제목 주인공형 | 사물 주인공형 ||---|---|---|| 언제 | 제목 자체가 궁금증을 일으킬 때, 그릴 만한 사물이 없을 때, 숫자·질문형 제목 | 주제를 한눈에 알려 주는 사물이 있을 때(영수증, 달력, 계산기, 상자, 휴대폰 화면) || 배치 | 제목 덩어리를 화면 가운데(가로·세로). 화면 폭의 55~80% | 왼쪽 글(폭 약 45%) + 오른쪽 사물(폭 약 33%), 사이 간격 40px 이상 || 제목 글자 | 110~140px | 90~112px || 장식 | 모서리에 큰 도형 1개(기울임), 옅게 | 사물 뒤 원형 후광 1개 || 시작 파일 | `assets/title-hero.html` | `assets/object-hero.html` | 공통 원칙:- 요소는 많아야 4개: 머리말(짧은 분류 한마디), 제목, 사물 또는 장식, 브랜드 표기. 본문 요약·날짜·저자·해시태그는 넣지 않는다(320px에서 전부 얼룩이 된다).- 색은 배경 1 + 글자 1 + 강조 1. 제목에서 가장 중요한 낱말(숫자가 있으면 숫자 쪽)에만 강조색.- 배경과 제목의 명도 차이를 크게(어두운 배경에 흰 글자, 밝은 배경에 먹색 글자). 사진·복잡한 무늬 위에 글자를 얹지 않는다. ## 2. 한글 제목 두 줄 덩어리 원래 제목을 그대로 넣지 않는다. **썸네일용으로 줄여 두 줄로 쪼갠다.** 1. 핵심 낱말만 남겨 전체 8~16자(띄어쓰기 제외)로 줄인다. 빠진 말은 머리말로 올린다. "연말정산 놓치기 쉬운 공제 7가지" → 머리말 `연말정산` + 제목 `놓치기 쉬운 / 공제 7가지`2. **뜻이 끊기는 자리에서** 직접 `<br>`로 나눈다. 브라우저 자동 줄바꿈에 맡기지 않는다(`white-space: nowrap`).3. 줄마다 4~8자. 두 줄 길이 차이는 3자 이내. 한쪽이 훨씬 짧으면 낱말을 옮기거나 표현을 바꾼다.4. 줄 첫머리에 조사·어미가 오지 않게, 숫자와 단위("7가지", "3개월")는 떼지 않는다.5. 강조색은 둘째 줄 또는 숫자 낱말 하나에.6. 줄 간격 1.1~1.2, 자간 -0.03em 안팎, 굵기 800~900. 두 줄이 한 덩어리로 보여야 한다. | 나쁜 쪼개기 | 좋은 쪼개기 ||---|---|| 연말정산 놓치기 쉬운 공제 / 7가지 (길이 불균형) | 놓치기 쉬운 / 공제 7가지 || 전세 계약 전에 꼭 / 확인할 것들 (힘이 빠진 말) | 전세 계약 전 / 등기부 3분 확인 || 초보자를 위한 엑셀 함 / 수 정리 (낱말 중간) | 엑셀 함수 / 이것만 12개 | 글자 크기 어림: 한글 한 자는 대략 글자 크기와 같은 폭이다. `글자 크기 ≈ 쓸 수 있는 폭 ÷ 긴 줄의 글자 수(빈칸은 0.3자)`. 제목 주인공형은 쓸 수 있는 폭 960px, 사물 주인공형은 520px 안팎. 계산값이 위 표의 범위보다 작게 나오면 제목을 더 줄인다(글자를 줄이지 않는다). **글꼴**: `"Pretendard", "Noto Sans KR", "Noto Sans CJK KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif` 순서로 지정해 설치된 것을 쓴다. 웹 글꼴을 `<link>`로 불러와도 되지만(찍을 때 `--wait`로 로딩을 기다린다) 네트워크가 막힌 환경에서는 설치 글꼴로 그려진다. 찍은 뒤 한글이 네모(□)로 나오면 한글 글꼴이 없는 환경이므로 사용자에게 알린다. ## 3. HTML 작성 규칙 `assets/`의 시작 파일을 복사해 고친다. 반드시 지킬 것: - `html, body { width: 1200px; height: 630px; margin: 0; overflow: hidden; }` — 찍는 크기와 같게 고정한다(1200×600이면 600).- 파일 하나로 끝낸다. CSS는 `<style>` 안에, 그림은 CSS 도형이나 인라인 SVG로. 외부 이미지를 쓰면 같은 폴더에 두고 상대 경로로.- `body`에 `word-break: keep-all`.- **중앙 80% 안에 핵심을 둔다**: 가로 120~1080px, 세로 63~567px(1200×600이면 60~540). 카카오톡 등 메신저 미리보기는 이미지를 2:1에 가깝게, 목록형 화면에서는 더 좁게 가운데만 잘라 보여 주는 경우가 있다. 가장자리 10%에는 배경과 장식만 둔다.- 검사 표식을 붙인다(스크립트가 이 속성으로 요소를 찾는다). | 속성 | 붙일 곳 | 뜻 | |---|---|---| | `data-check="이름"` | 머리말, 제목, 사물, 브랜드 등 눈에 보이는 주요 요소 | 겹침·이탈·여백 검사 대상 | | `data-core` | 제목, 주인공 사물 | 중앙 80% 안에 있어야 함 | | `data-lines="2"` | 제목 | 실제로 2줄로 그려졌는지 확인 | | `data-bleed` | 일부러 화면 밖으로 나가는 장식 | 이탈·여백 검사 제외 | | `data-overlap-ok` | 일부러 겹치는 요소(사물 위 도장 등) | 겹침 검사 제외 | | `data-small-ok` | 브랜드 표기, 사물 안의 장식 글자 | 작은 글자 경고 제외 | **사물 그리기**- 사물은 **5~15도 기울인다**(`transform: rotate(8deg)`). 수평·수직으로 반듯한 사물은 문서 도형처럼 죽어 보인다. 기울이면 움직임이 생기고 반듯한 제목과 대비된다. 15도를 넘으면 넘어지는 것처럼 보인다.- 제목은 기울이지 않는다(가독성).- 사물은 단순한 큰 덩어리로: 둥근 사각형 + 줄 몇 개 + 포인트 색 하나. 320px에서 윤곽으로 무엇인지 알 수 있어야 한다. 세밀한 묘사는 보이지 않는다.- 그림자(`box-shadow: 0 30px 60px rgba(0,0,0,.3)`)로 배경에서 띄운다.- 사물 위에 작은 요소(도장, 배지)를 반대 방향으로 기울여 얹으면 생동감이 더해진다. 얹는 요소는 `data-overlap-ok`.- 회전한 요소는 바깥 상자가 커진다(폭 280·높이 360을 8도 돌리면 약 327×395). 영역을 넉넉히 잡는다. ## 4. 찍기 + 배치 검사 ```bashpython3 scripts/shot.py thumb.html -o thumb.png --check # 1200×630python3 scripts/shot.py thumb.html -o thumb.png --size 1200x600 --check``` 스크립트는 파이썬 표준 라이브러리만 쓰고, 설치된 크롬·크로미움·엣지를 찾아 헤드리스로 실행한다(못 찾으면 `--chrome 경로` 또는 환경 변수 `CHROME`). 웹 글꼴·이미지 로딩이 느리면 `--wait 6000`. 출력 읽는 법: | 출력 | 뜻 | 조치 ||---|---|---|| `[찍기] … 1200×630px` | PNG 생성, 크기 확인 | 크기가 다르면 body 고정 크기 확인 || 요소별 `x y 폭×높이` | 실제 그려진 좌표 | 여백·간격 계산에 쓴다 || `[여백] 왼쪽·오른쪽·위·아래` | 검사 요소 전체를 감싼 상자와 가장자리 사이 | 좌우 차이 96px, 상하 차이 63px 이내가 기준 || `[오류] A ↔ B 겹침` | 두 요소가 겹침 | 위치·크기 조정. 의도면 `data-overlap-ok` || `[오류] 핵심 요소가 중앙 80% 밖` | 잘리면 사라질 수 있음 | 안쪽으로 옮기거나 줄인다 || `[오류] 제목이 N줄로 그려짐` | 의도한 줄 수와 다름 | 글자 크기·줄바꿈 수정 || `[오류] 캔버스 밖으로 나감` | 요소가 잘림 | 의도한 장식이면 `data-bleed` || `[경고] 320px 축소 시 글자 Npx` | 축소하면 못 읽는 글자 | 키우거나 뺀다 || `[경고] 한쪽으로 쏠림` / `여백 Npx` | 균형이 깨짐 | 5단계에서 눈으로 판단 | `[오류]`가 하나라도 있으면 종료 코드 1이다. 오류 0건이 될 때까지 고친다. 경고는 눈으로 보고 판단한다(사물 주인공형에서 글과 사물의 무게가 달라 좌우 여백이 조금 다른 것은 괜찮다). ## 5. 확인판을 눈으로 보기 `--check`는 `thumb_check.png`를 함께 만든다. **이 이미지를 직접 열어** 아래를 확인한다. 기계 검사는 좌표만 본다. 색 대비, 덩어리감, 사물이 무엇으로 보이는지는 눈으로만 알 수 있다. 1. **320px 축소본**: 제목 두 줄이 한눈에 읽히는가. 강조 낱말이 먼저 보이는가. 사물이 윤곽만으로 무엇인지 알 수 있는가.2. **메신저 미리보기 2:1**: 위아래가 잘려도 제목·사물이 온전한가.3. **중앙 80% 안내선**: 제목과 주인공 사물이 빨간 점선 안에 있는가.4. **원본**: 한글이 네모로 깨지지 않았는가. 글자 획이 장식·사물과 닿지 않는가. 한쪽이 비어 보이지 않는가. 사물이 5~15도로 기울어 있는가. 문제가 있으면 HTML을 고치고 4단계부터 다시 한다. 보통 2~3회 돈다. ## 6. 납품 사용자에게 줄 것:- PNG 경로와 크기, 파일 용량(300KB를 넘으면 그림자·그러데이션을 줄인다)- 수정용 HTML 경로- 검사 결과 요약 한 줄(오류 0건, 남은 경고와 그대로 둔 이유)- 페이지에 넣을 메타 태그 ```html<meta property="og:image" content="https://example.com/path/thumb.png"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image">``` 여러 장을 만들 때(글 목록 전체)는 HTML 하나를 틀로 삼아 제목·머리말·강조색만 바꿔 파일을 만들고 장마다 `--check`를 돌린다. 제목 길이가 달라지면 줄 수·겹침이 달라지므로 한 장만 검사하고 나머지를 통과로 치지 않는다. ## 완료 전 점검표 - [ ] 구도가 제목 주인공형/사물 주인공형 중 하나이고 요소가 4개 이하다- [ ] 제목이 뜻 단위로 나뉜 두 줄이고 줄 길이 차이가 3자 이내다- [ ] `--check` 오류 0건, PNG 크기가 요청과 같다- [ ] 확인판을 열어 320px 축소본에서 제목이 읽히는 것을 봤다- [ ] 제목과 주인공 사물이 중앙 80% 안에 있다- [ ] 사물이 5~15도 기울어 있고 제목은 수평이다- [ ] 한글이 깨지지 않았다- [ ] 실존 회사 로고·상표·인물 사진을 임의로 넣지 않았다- [ ] PNG·HTML 경로와 메타 태그를 전달했다<!doctype html><html lang="ko"><head><meta charset="utf-8"><title>사물 주인공형 1200×630</title><style> :root { --w: 1200px; --h: 630px; --bg: #14213D; --ink: #FFFFFF; --accent: #FFD43B; } * { box-sizing: border-box; margin: 0; padding: 0; } html, body { width: var(--w); height: var(--h); overflow: hidden; } body { background: var(--bg); color: var(--ink); position: relative; font-family: "Pretendard", "Noto Sans KR", "Noto Sans CJK KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; word-break: keep-all; } /* 왼쪽 글 영역: 가로 120~640 */ .copy { position: absolute; left: 120px; top: 63px; bottom: 63px; width: 520px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 26px; } .kicker { font-size: 28px; font-weight: 700; padding: 8px 18px; border-radius: 999px; background: rgba(255,255,255,.12); color: var(--accent); } .title { font-size: 100px; font-weight: 900; line-height: 1.14; letter-spacing: -0.035em; white-space: nowrap; } .title em { font-style: normal; color: var(--accent); } /* 오른쪽 사물 영역: 가로 680~1080. 사물은 5~15도 기울인다 */ .object-wrap { position: absolute; left: 680px; top: 63px; width: 400px; height: 504px; display: flex; align-items: center; justify-content: center; } .object { width: 280px; height: 360px; border-radius: 20px; background: #fff; transform: rotate(8deg); box-shadow: 0 30px 60px rgba(0,0,0,.35); } .halo { position: absolute; left: 700px; top: 135px; width: 360px; height: 360px; border-radius: 50%; background: var(--accent); opacity: .16; }</style></head><body> <div class="halo"></div> <div class="copy"> <div class="kicker" data-check="머리말" data-core>머리말</div> <h1 class="title" data-check="제목" data-core data-lines="2">첫 줄 덩어리<br><em>둘째 줄</em></h1> </div> <div class="object-wrap"> <!-- 사물: CSS 도형·인라인 SVG·이미지 중 하나. 회전된 실제 외곽으로 검사된다 --> <div class="object" data-check="사물" data-core></div> </div></body></html><!doctype html><html lang="ko"><head><meta charset="utf-8"><title>제목 주인공형 1200×630</title><style> /* 캔버스: 찍는 크기와 반드시 같게. 1200×600으로 찍을 때는 --h 만 600으로 */ :root { --w: 1200px; --h: 630px; --bg: #F4F1EA; --ink: #16181D; --accent: #E8590C; } * { box-sizing: border-box; margin: 0; padding: 0; } html, body { width: var(--w); height: var(--h); overflow: hidden; } body { background: var(--bg); color: var(--ink); position: relative; font-family: "Pretendard", "Noto Sans KR", "Noto Sans CJK KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; word-break: keep-all; /* 한글이 낱말 중간에서 끊기지 않게 */ } /* 중앙 80% 안(가로 120~1080, 세로 63~567)에 제목 덩어리를 가로·세로 가운데로 */ .stage { position: absolute; left: 120px; right: 120px; top: 63px; bottom: 63px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 28px; } .kicker { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; color: var(--accent); } .title { font-size: 128px; font-weight: 900; line-height: 1.12; letter-spacing: -0.035em; white-space: nowrap; } .title em { font-style: normal; color: var(--accent); } .brand { font-size: 26px; font-weight: 700; opacity: .55; } /* 장식: 제목 뒤에 깔리는 도형. 기울여서 정적인 화면을 깬다 */ .deco { position: absolute; right: -60px; top: -80px; width: 380px; height: 380px; border-radius: 48px; background: var(--accent); opacity: .12; transform: rotate(12deg); }</style></head><body> <div class="deco"></div> <div class="stage"> <div class="kicker" data-check="머리말" data-core>머리말 한 줄</div> <!-- 두 줄 덩어리: 뜻 단위로 직접 <br>. data-lines 는 의도한 줄 수 --> <h1 class="title" data-check="제목" data-core data-lines="2">첫 줄 여섯 자<br><em>둘째 줄</em> 덩어리</h1> <div class="brand" data-check="브랜드" data-small-ok>brand.example</div> </div></body></html>#!/usr/bin/env python3"""HTML 한 장을 크롬 헤드리스로 찍어 썸네일·OG 이미지(PNG)를 만든다. 파이썬 표준 라이브러리만 쓴다. 사용법 python3 shot.py thumb.html # thumb.png (1200x630) python3 shot.py thumb.html --size 1200x600 # 2:1 python3 shot.py thumb.html -o og.png --check # 찍기 + 배치 검사 + 축소 확인판(og_check.png) --check 가 하는 일 1) 배치 검사: data-check 속성이 붙은 요소의 실제 좌표를 읽어 겹침, 캔버스 밖 삐져나감, 가장자리 여백, 중앙 80% 이탈(data-core), 제목 줄 수(data-lines), 320px 축소 시 글자 크기를 검사한다. 2) 확인판: 원본 축소본 + 320px 축소본 + 2:1 가운데 자르기(중앙 80% 안내선)를 한 장에 모아 찍는다. 이 이미지를 직접 열어 눈으로 확인한다. 종료 코드: 0 = 통과(경고만 있어도 0), 1 = 오류(찍기 실패·크기 불일치·배치 오류)크롬 경로를 못 찾으면 --chrome 또는 환경 변수 CHROME 으로 지정한다."""import argparseimport jsonimport osimport reimport shutilimport structimport subprocessimport sysimport tempfileimport urllib.parsefrom pathlib import Path CANDIDATES = [ "google-chrome", "google-chrome-stable", "chromium", "chromium-browser", "chrome", "microsoft-edge", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "/Applications/Chromium.app/Contents/MacOS/Chromium", "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge", r"C:\Program Files\Google\Chrome\Application\chrome.exe", r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe",] LINT_JS = r"""<script>(function () { function run() { var W = __W__, H = __H__, out = {items: [], errors: [], warnings: []}; var body = document.body.getBoundingClientRect(); if (Math.round(body.width) !== W || Math.round(body.height) !== H) out.errors.push('body 크기가 ' + Math.round(body.width) + '×' + Math.round(body.height) + ' — 캔버스 ' + W + '×' + H + '와 같게 고정할 것'); var els = Array.prototype.slice.call(document.querySelectorAll('[data-check]')); if (!els.length) out.warnings.push('data-check 속성이 붙은 요소가 없어 배치 검사를 건너뜀'); var boxes = els.map(function (el) { var r = el.getBoundingClientRect(), cs = getComputedStyle(el); var b = {name: el.getAttribute('data-check') || el.tagName.toLowerCase(), l: r.left, t: r.top, r: r.right, b: r.bottom, w: r.width, h: r.height, font: null, el: el}; var tw = document.createTreeWalker(el, NodeFilter.SHOW_TEXT), n; // 안에 든 글자 중 가장 작은 크기 while ((n = tw.nextNode())) { if (!n.nodeValue.trim()) continue; var f = parseFloat(getComputedStyle(n.parentElement).fontSize); if (b.font === null || f < b.font) b.font = f; } out.items.push({name: b.name, x: Math.round(b.l), y: Math.round(b.t), w: Math.round(b.w), h: Math.round(b.h)}); return b; }); boxes.forEach(function (b) { var el = b.el; if (!el.hasAttribute('data-bleed') && (b.l < -0.5 || b.t < -0.5 || b.r > W + 0.5 || b.b > H + 0.5)) out.errors.push(b.name + ': 캔버스 밖으로 나감 (' + Math.round(b.l) + ',' + Math.round(b.t) + ' ~ ' + Math.round(b.r) + ',' + Math.round(b.b) + ')'); if (el.hasAttribute('data-core') && (b.l < W * 0.1 - 0.5 || b.r > W * 0.9 + 0.5 || b.t < H * 0.1 - 0.5 || b.b > H * 0.9 + 0.5)) out.errors.push(b.name + ': 핵심 요소가 중앙 80% 밖 (가로 ' + Math.round(W * 0.1) + '~' + Math.round(W * 0.9) + ', 세로 ' + Math.round(H * 0.1) + '~' + Math.round(H * 0.9) + ' 안에 둘 것)'); if (el.scrollWidth > el.clientWidth + 1 && getComputedStyle(el).overflow !== 'visible') out.errors.push(b.name + ': 글자가 상자 폭을 넘쳐 잘림'); if (el.hasAttribute('data-lines')) { var want = parseInt(el.getAttribute('data-lines'), 10), tops = {}, range = document.createRange(); range.selectNodeContents(el); Array.prototype.forEach.call(range.getClientRects(), function (rc) { if (rc.width > 1) tops[Math.round(rc.top / 4)] = 1; }); var got = Object.keys(tops).length; if (got !== want) out.errors.push(b.name + ': 제목이 ' + got + '줄로 그려짐 (의도 ' + want + '줄). 글자 크기를 줄이거나 줄바꿈 위치를 고칠 것'); } if (b.font !== null && !el.hasAttribute('data-small-ok')) { var at320 = b.font * 320 / W; if (at320 < 7) out.warnings.push(b.name + ': 320px 축소 시 가장 작은 글자 ' + at320.toFixed(1) + 'px — 읽히지 않음. 빼거나 ' + Math.ceil(7 * W / 320) + 'px 이상으로(장식 글자면 data-small-ok)'); } }); for (var i = 0; i < boxes.length; i++) for (var j = i + 1; j < boxes.length; j++) { var a = boxes[i], c = boxes[j]; if (a.el.contains(c.el) || c.el.contains(a.el)) continue; if (a.el.hasAttribute('data-overlap-ok') || c.el.hasAttribute('data-overlap-ok')) continue; var ox = Math.min(a.r, c.r) - Math.max(a.l, c.l), oy = Math.min(a.b, c.b) - Math.max(a.t, c.t); if (ox > 1 && oy > 1) out.errors.push(a.name + ' ↔ ' + c.name + ': ' + Math.round(ox) + '×' + Math.round(oy) + 'px 겹침'); else if (ox > 1 && oy > -12 || oy > 1 && ox > -12) out.warnings.push(a.name + ' ↔ ' + c.name + ': 간격 12px 미만으로 붙어 있음'); } var inner = boxes.filter(function (b) { return !b.el.hasAttribute('data-bleed'); }); if (inner.length) { var L = Math.min.apply(null, inner.map(function (b) { return b.l; })), T = Math.min.apply(null, inner.map(function (b) { return b.t; })); var R = W - Math.max.apply(null, inner.map(function (b) { return b.r; })), B = H - Math.max.apply(null, inner.map(function (b) { return b.b; })); out.margins = {left: Math.round(L), right: Math.round(R), top: Math.round(T), bottom: Math.round(B)}; var minM = Math.min(L, R, T, B); if (minM < H * 0.06) out.warnings.push('가장자리 여백 ' + Math.round(minM) + 'px — ' + Math.round(H * 0.06) + 'px 이상 권장'); if (Math.abs(L - R) > W * 0.08) out.warnings.push('좌우 여백 차이 ' + Math.round(Math.abs(L - R)) + 'px (왼쪽 ' + Math.round(L) + ', 오른쪽 ' + Math.round(R) + ') — 한쪽으로 쏠림'); if (Math.abs(T - B) > H * 0.10) out.warnings.push('상하 여백 차이 ' + Math.round(Math.abs(T - B)) + 'px (위 ' + Math.round(T) + ', 아래 ' + Math.round(B) + ') — 한쪽으로 쏠림'); } document.documentElement.setAttribute('data-thumb-lint', encodeURIComponent(JSON.stringify(out))); } function go() { (document.fonts && document.fonts.ready ? document.fonts.ready : Promise.resolve()).then(run, run); } if (document.readyState === 'complete') go(); else window.addEventListener('load', go);})();</script>""" SHEET = """<!doctype html><html><head><meta charset="utf-8"><style>*{{box-sizing:border-box}} body{{margin:0;width:1000px;background:#e9ebee;font:14px/1.4 system-ui,sans-serif;color:#333;padding:24px}}h3{{margin:0 0 8px;font-size:14px;font-weight:600}} .row{{display:flex;gap:24px;align-items:flex-start;margin-bottom:22px}}img{{display:block}} .crop{{position:relative;width:560px;height:280px;overflow:hidden}}.crop img{{width:560px;height:280px;object-fit:cover;object-position:center}}.guide{{position:absolute;left:10%;top:10%;width:80%;height:80%;border:2px dashed #ff2d55;box-sizing:border-box}}.chat{{background:#b2c7d9;padding:16px;width:352px}} .card{{background:#fff;border-radius:10px;overflow:hidden;width:320px}}.card img{{width:320px;height:160px;object-fit:cover}} .meta{{padding:9px 12px;font-size:13px;color:#222}} .meta small{{color:#999;display:block}}</style></head><body><div class="row"><div><h3>원본 {w}×{h} (절반 크기)</h3><img src="{src}" width="{hw}"></div></div><div class="row"> <div><h3>320px 축소: 제목이 한눈에 읽혀야 한다</h3><img src="{src}" width="320"></div> <div><h3>메신저 미리보기 2:1 (가운데 자르기, 폭 320px)</h3><div class="chat"><div class="card"><img src="{src}"><div class="meta">링크 제목 자리<small>example.com</small></div></div></div></div></div><div class="row"><div><h3>2:1 가운데 자르기 + 중앙 80% 안내선(빨간 점선): 제목·주인공 사물이 안에 있어야 한다</h3> <div class="crop"><img src="{src}"><div class="guide"></div></div></div></div></body></html>""" def find_chrome(explicit): for cand in [explicit, os.environ.get("CHROME")] + CANDIDATES: if not cand: continue if os.path.isfile(cand): return cand found = shutil.which(cand) if found: return found sys.exit("크롬(또는 크로미움·엣지)을 찾지 못했습니다. --chrome 경로 또는 환경 변수 CHROME 을 지정하세요.") def run_chrome(chrome, args, wait_ms, timeout=90): profile = tempfile.mkdtemp(prefix="thumb-shot-") cmd = [chrome, "--headless=new", "--disable-gpu", "--hide-scrollbars", "--force-device-scale-factor=1", "--no-first-run", "--no-default-browser-check", "--disable-extensions", "--allow-file-access-from-files", f"--user-data-dir={profile}", f"--virtual-time-budget={wait_ms}"] if hasattr(os, "geteuid") and os.geteuid() == 0 or os.environ.get("THUMB_NO_SANDBOX"): cmd.append("--no-sandbox") try: return subprocess.run(cmd + args, capture_output=True, text=True, timeout=timeout, errors="replace") except subprocess.TimeoutExpired: sys.exit(f"크롬이 {timeout}초 안에 끝나지 않았습니다.") finally: shutil.rmtree(profile, ignore_errors=True) def png_size(path): with open(path, "rb") as f: head = f.read(24) if len(head) < 24 or head[:8] != b"\x89PNG\r\n\x1a\n": return None return struct.unpack(">II", head[16:24]) def screenshot(chrome, html, out, w, h, wait_ms): if out.exists(): out.unlink() res = run_chrome(chrome, [f"--window-size={w},{h}", f"--screenshot={out}", html.resolve().as_uri()], wait_ms) if not out.exists(): sys.exit("찍기 실패: PNG가 만들어지지 않았습니다.\n" + (res.stderr or "")[-800:]) return png_size(out) def lint(chrome, html, w, h, wait_ms): src = html.read_text(encoding="utf-8") tmp = html.with_name(f".{html.stem}.lint.html") # 상대 경로 자원이 그대로 읽히도록 같은 폴더에 둔다 low = src.lower() pos = low.rfind("</body>") js = LINT_JS.replace("__W__", str(w)).replace("__H__", str(h)) tmp.write_text(src[:pos] + js + src[pos:] if pos >= 0 else src + js, encoding="utf-8") try: # --dump-dom 은 창 높이에서 테두리만큼 뷰포트가 줄어든다. 좌표는 body 고정 크기 기준이라 높이에 여유만 둔다 res = run_chrome(chrome, [f"--window-size={w},{h + 300}", "--dump-dom", tmp.resolve().as_uri()], wait_ms) finally: tmp.unlink(missing_ok=True) m = re.search(r'data-thumb-lint="([^"]+)"', res.stdout or "") if not m: return None return json.loads(urllib.parse.unquote(m.group(1))) def main(): ap = argparse.ArgumentParser(description="HTML 한 장을 크롬 헤드리스로 찍어 PNG 썸네일을 만든다.") ap.add_argument("html", help="찍을 HTML 파일") ap.add_argument("-o", "--out", help="출력 PNG 경로 (기본: HTML과 같은 이름 .png)") ap.add_argument("--size", default="1200x630", help="가로x세로 (기본 1200x630, 2:1은 1200x600)") ap.add_argument("--check", action="store_true", help="배치 검사와 축소 확인판(_check.png) 생성") ap.add_argument("--wait", type=int, default=3000, help="글꼴·이미지 로딩 대기(ms, 기본 3000)") ap.add_argument("--chrome", help="크롬 실행 파일 경로") a = ap.parse_args() html = Path(a.html) if not html.is_file(): sys.exit(f"파일이 없습니다: {html}") m = re.fullmatch(r"(\d+)[xX×](\d+)", a.size) if not m: sys.exit("--size 는 1200x630 형식으로 적습니다.") w, h = int(m.group(1)), int(m.group(2)) out = Path(a.out) if a.out else html.with_suffix(".png") chrome = find_chrome(a.chrome) failed = False size = screenshot(chrome, html, out, w, h, a.wait) print(f"[찍기] {out} {size[0]}×{size[1]}px {out.stat().st_size // 1024}KB") if size != (w, h): print(f"[오류] 이미지 크기가 {w}×{h}가 아닙니다. html·body에 margin:0, width:{w}px, height:{h}px, overflow:hidden 을 확인하세요.") failed = True if a.check: rep = lint(chrome, html, w, h, a.wait) if rep is None: print("[오류] 배치 검사 결과를 읽지 못했습니다(HTML에 </body>가 있는지 확인).") failed = True else: for it in rep["items"]: print(f" - {it['name']}: x={it['x']} y={it['y']} {it['w']}×{it['h']}") if rep.get("margins"): mg = rep["margins"] print(f"[여백] 왼쪽 {mg['left']} · 오른쪽 {mg['right']} · 위 {mg['top']} · 아래 {mg['bottom']} (px)") for e in rep["errors"]: print("[오류]", e) for wmsg in rep["warnings"]: print("[경고]", wmsg) if rep["errors"]: failed = True if not rep["errors"] and not rep["warnings"]: print("[배치] 겹침·이탈·쏠림 없음") sheet_png = out.with_name(out.stem + "_check.png") sheet_html = out.with_name(f".{out.stem}.sheet.html") sheet_html.write_text(SHEET.format(src=urllib.parse.quote(out.name), w=w, h=h, hw=w // 2), encoding="utf-8") try: sheet_h = 24 + 30 + h // 2 + 22 + 30 + 260 + 22 + 30 + 280 + 24 screenshot(chrome, sheet_html, sheet_png, 1000, sheet_h, 1500) finally: sheet_html.unlink(missing_ok=True) print(f"[확인판] {sheet_png} ← 이 이미지를 열어 320px 가독성과 2:1 잘림을 눈으로 확인") sys.exit(1 if failed else 0) if __name__ == "__main__": main()스킬 적용 실행 결과 예시
결과물
| 파일 | 내용 |
|---|---|
output.png |
OG 이미지 1200×630px, 64KB |
thumb.html |
수정용 원본(HTML/CSS 한 장, 외부 파일 없음) |
output_check.png |
확인판: 원본 축소본 · 320px 축소본 · 메신저 2:1 미리보기 · 중앙 80% 안내선 |
설계
- 크기: 1200×630 (카카오톡·SNS 공유용 OG 표준). 2:1로 잘려도 남도록 핵심을 중앙 80% 안에 배치.
- 구도: 사물 주인공형. "공제"를 한눈에 알려 주는 사물(영수증)이 있어서 선택. 왼쪽 글 + 오른쪽 영수증.
- 제목 두 줄 덩어리: 원제 "연말정산 놓치기 쉬운 공제 7가지"(띄어쓰기 제외 15자)
→ 머리말
연말정산+ 제목놓치기 쉬운/공제 7가지(5자 / 5자, 숫자와 단위 붙임) - 글자: 제목 108px · 굵기 900 · 줄 간격 1.14 · 자간 -0.035em. 320px로 줄면 약 29px.
- 색: 배경 남색
#14213D+ 글자 흰색 + 강조 노랑#FFD43B(둘째 줄과 도장에만) - 사물: CSS로 그린 영수증을 8도 기울임. 빠뜨린 항목 3줄만 빨강. 그 위에 "7가지" 도장을 반대 방향(-14도)으로 얹음.
- 요소 수: 머리말, 제목, 브랜드(살림숫자), 영수증 — 4개.
찍기·배치 검사 (python3 scripts/shot.py thumb.html -o output.png --check)
[찍기] output.png 1200×630px 64KB
- 머리말: x=120 y=124 144×52
- 제목: x=120 y=202 469×246
- 브랜드: x=120 y=475 90×31
- 영수증: x=730 y=112 319×406
- 도장: x=907 y=342 145×145
[여백] 왼쪽 120 · 오른쪽 147 · 위 112 · 아래 112 (px)
[배치] 겹침·이탈·쏠림 없음
[확인판] output_check.png
- 오류 0건, 경고 0건.
- 제목 오른쪽 끝(589px)과 영수증 왼쪽 끝(730px) 사이 간격 141px.
- 제목(120~589, 202~448)과 영수증(730~1049, 112~518) 모두 중앙 80%(가로 120~1080, 세로 63~567) 안.
고친 내역 (1차 → 최종)
| 1차에서 걸린 것 | 조치 |
|---|---|
| 영수증 아래 톱니 장식이 의도와 다르게 하트 모양 점으로 그려짐(확인판에서 발견) | 톱니를 없애고 둥근 모서리 카드로 단순화 |
| 사물 뒤 노란 후광이 남색과 섞여 탁하게 보임(확인판에서 발견) | 흰색 7% 후광으로 교체 |
| 영수증·도장 안 글자가 320px에서 6px 미만이라는 경고 | 읽히라고 넣은 글자가 아니라 사물의 일부이므로 data-small-ok 표시 |
확인판에서 눈으로 본 것
- 320px 축소본: "놓치기 쉬운 / 공제 7가지" 두 줄이 읽히고 노란 둘째 줄이 먼저 보임. 영수증은 윤곽과 빨간 표시로 구분됨.
- 메신저 2:1 미리보기: 위아래가 잘려도 머리말·제목·브랜드·영수증 모두 온전함.
- 한글 깨짐 없음, 글자와 사물이 닿는 곳 없음.
페이지에 넣을 태그
<meta property="og:image" content="https://example.com/images/year-end-tax-7.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary_large_image">
content 주소는 실제 올린 경로로 바꿉니다.
블로그에 "연말정산 놓치기 쉬운 공제 7가지"라는 글을 올립니다. 카카오톡이랑 SNS에 공유할 때 뜨는 대표 이미지(OG 이미지) 하나 만들어 주세요. 사진 소스는 없습니다. 블로그 이름은 "살림숫자"(가상의 블로그)입니다.
클로드 스킬 설치 및 실행 방법
스킬 ZIP 파일 다운로드
원하는 작업의 상세 페이지에서 SKILL.md 폴더가 들어 있는 zip 파일을 다운로드합니다.
claude.ai 또는 Claude Code에 등록
웹에서는 claude.ai 설정의 스킬 업로드 메뉴에 등록하고, Claude Code에서는 압축을 풀어 ~/.claude/skills/ 폴더 안에 넣습니다.
대화창에서 작업 지시
상세 페이지에 안내된 발동 문구와 함께 작업할 원고나 데이터 파일을 입력하면 등록된 스킬 규칙에 따라 결과가 출력됩니다.
클로드 스킬 12종
slop-free-deck/ ├─ SKILL.md ├─ references/ │ ├─ layout-catalog.md │ └─ palette-derivation.md └─ scripts/ └─ deck_check.pyAI 흔적 제거 덱 디자인 규칙 클로드가 만드는 PPT에서 AI 특유의 상투적 레이아웃을 제거 “PPT 만들어 줘” slop-free-deck.zip21KB
korean-report-style/ ├─ SKILL.md └─ references/ ├─ rewrite-list.md └─ structures.md한국 회사 보고서 문체 규칙 두괄식 결론 제시와 개조식 문장, 숫자 및 단위 표기 기준 적용 “이 초안을 검토 보고서로 바꿔 줘” korean-report-style.zip17KB
meeting-minutes-kr/ ├─ SKILL.md └─ references/ └─ formats.md한국형 회의록 및 후속 메일 안건별 결정 사항 정리와 참석자 공유용 후속 메일 동시 작성 “이 녹취 회의록으로 정리해 줘” meeting-minutes-kr.zip10KB
weekly-report-kr/ ├─ SKILL.md └─ references/ └─ sentence-examples.md주간업무보고 성과 및 연속성 성과 중심 문장 변환과 진행 상태 표기, 전주 대비 연속성 유지 “이번 주 주간보고 써 줘” weekly-report-kr.zip11KB
proposal-writer-kr/ ├─ SKILL.md └─ references/ └─ chapter-guide.mdB2B 제안서 논리 구조 작성 고객사 과제 재정의부터 장별 핵심 주장과 정량 근거 배치 “제안서 써 줘” proposal-writer-kr.zip8KB
public-bid-proposal/ ├─ SKILL.md └─ references/ └─ requirement-extraction.md공공입찰 제안서 요구사항 대응 제안요청서 요구사항 전수 추출과 평가항목 조견표 기반 집필 “제안요청서 분석해 줘” public-bid-proposal.zip8KB
data-story-chart/ ├─ SKILL.md └─ references/ └─ recipes.md데이터 메시지 및 차트 선택 숫자 데이터에서 핵심 메시지를 도출하고 적합한 차트 유형 매칭 “이 데이터로 차트 만들어 줘” data-story-chart.zip8KB
seo-article-kr/ ├─ SKILL.md └─ references/ └─ ai-style-fixes.md한국어 검색 유입 아티클 작성 검색 의도 충족 구조와 자연스러운 한국어 문체로 정보 글 집필 “이 키워드로 블로그 글 써줘” seo-article-kr.zip10KB
brand-voice-keeper/ ├─ SKILL.md ├─ references/ │ └─ voice-card-template.md └─ scripts/ └─ voice_stats.py브랜드 문체 추출 및 일관 유지 기존 발행 글에서 어미와 어휘 습관을 추출해 새 원고에 적용 “우리 문체로 써줘” brand-voice-keeper.zip10KB
excel-analyst-kr/ ├─ SKILL.md ├─ references/ │ └─ number-style.md └─ scripts/ └─ profile_csv.py엑셀 및 CSV 데이터 분석 보고 원본 테이블 요약 통계부터 이상치 확인, 의사결정 시사점 정리 “이 엑셀 분석해서 보고 자료로 정리해줘” excel-analyst-kr.zip14KB
email-reply-kr/ ├─ SKILL.md └─ references/ └─ phrases.md한국어 비즈니스 메일 회신 수신 메일 쟁점 파악 후 수락, 조율, 거절 상황별 회신 작성 “이 메일 답장 써줘” email-reply-kr.zip11KB