thumbnail-maker 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of thumbnail-maker might be problematic. Click here for more details.
- thumbnail_maker-0.1.1/.github/workflows/generate-thumbnail.yml +42 -0
- thumbnail_maker-0.1.1/.gitignore +169 -0
- thumbnail_maker-0.1.1/PKG-INFO +158 -0
- thumbnail_maker-0.1.1/README.md +146 -0
- thumbnail_maker-0.1.1/_old_python/generateThumbnail.py +38 -0
- thumbnail_maker-0.1.1/_old_python/genthumb.py +60 -0
- thumbnail_maker-0.1.1/_old_python/main_gui.py +533 -0
- thumbnail_maker-0.1.1/_old_python/thumbnailRenderer.py +353 -0
- thumbnail_maker-0.1.1/bg.png +0 -0
- thumbnail_maker-0.1.1/create_image_using_nanobanana.py +233 -0
- thumbnail_maker-0.1.1/create_notion.py +213 -0
- thumbnail_maker-0.1.1/fonts/Chosunilbo_myungjo-normal-normal.woff +0 -0
- thumbnail_maker-0.1.1/fonts/NanumBrushScript-bold-normal.ttf +0 -0
- thumbnail_maker-0.1.1/fonts/NanumBrushScript-normal-normal.ttf +0 -0
- thumbnail_maker-0.1.1/fonts/Nanum_Brush_Script-bold-normal.ttf +0 -0
- thumbnail_maker-0.1.1/fonts/SBAggroB-bold-normal.ttf +0 -0
- thumbnail_maker-0.1.1/fonts/SBAggroB-bold-normal.woff +0 -0
- thumbnail_maker-0.1.1/fonts/SBAggroB-normal-normal.ttf +0 -0
- thumbnail_maker-0.1.1/fonts/SBAggroB-normal-normal.woff +0 -0
- thumbnail_maker-0.1.1/generateThumbnail.js +205 -0
- thumbnail_maker-0.1.1/genthumb.js +88 -0
- thumbnail_maker-0.1.1/img_upload.js +471 -0
- thumbnail_maker-0.1.1/img_upload.py +526 -0
- thumbnail_maker-0.1.1/index.html +776 -0
- thumbnail_maker-0.1.1/my_thumb.json +66 -0
- thumbnail_maker-0.1.1/mytemp.json +48 -0
- thumbnail_maker-0.1.1/myth1.thl +0 -0
- thumbnail_maker-0.1.1/p2.png +0 -0
- thumbnail_maker-0.1.1/p4.png +0 -0
- thumbnail_maker-0.1.1/package-lock.json +782 -0
- thumbnail_maker-0.1.1/package.json +20 -0
- thumbnail_maker-0.1.1/pp.png +0 -0
- thumbnail_maker-0.1.1/preview_temp.png +0 -0
- thumbnail_maker-0.1.1/pyproject.toml +17 -0
- thumbnail_maker-0.1.1/requirements.txt +9 -0
- thumbnail_maker-0.1.1/test_output.png +0 -0
- thumbnail_maker-0.1.1/thumbnail.json +64 -0
- thumbnail_maker-0.1.1/thumbnail.png +0 -0
- thumbnail_maker-0.1.1/thumbnailRenderer.js +492 -0
- thumbnail_maker-0.1.1/thumbnail_maker/__init__.py +9 -0
- thumbnail_maker-0.1.1/thumbnail_maker/__main__.py +71 -0
- thumbnail_maker-0.1.1/thumbnail_maker/cli.py +140 -0
- thumbnail_maker-0.1.1/thumbnail_maker/cli_new.py +38 -0
- thumbnail_maker-0.1.1/thumbnail_maker/gui.py +861 -0
- thumbnail_maker-0.1.1/thumbnail_maker/renderer.py +544 -0
- thumbnail_maker-0.1.1/uv.lock +825 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Generate Thumbnail
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
paths:
|
|
6
|
+
- 'thumbnail.json' # DSL 파일 변경 시 트리거
|
|
7
|
+
workflow_dispatch: # 수동 실행 가능
|
|
8
|
+
repository_dispatch:
|
|
9
|
+
types: [generate-thumbnail] # 웹훅으로 트리거 가능
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
generate:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout repository
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Setup Node.js
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: '18'
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: npm install
|
|
26
|
+
|
|
27
|
+
- name: Install Playwright browsers
|
|
28
|
+
run: npx playwright install --with-deps
|
|
29
|
+
|
|
30
|
+
- name: Generate thumbnail with Canvas
|
|
31
|
+
run: node generateThumbnail.js thumbnail.json thumbnail-canvas.png
|
|
32
|
+
|
|
33
|
+
- name: Generate thumbnail with Playwright
|
|
34
|
+
run: node genthumb.js thumbnail.json thumbnail-playwright.png
|
|
35
|
+
|
|
36
|
+
- name: Upload thumbnails as artifacts
|
|
37
|
+
uses: actions/upload-artifact@v4
|
|
38
|
+
with:
|
|
39
|
+
name: generated-thumbnails
|
|
40
|
+
path: |
|
|
41
|
+
thumbnail-canvas.png
|
|
42
|
+
thumbnail-playwright.png
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Please take extra care not to add rules that will make tracked files ignored.
|
|
2
|
+
# To test that, run `git ls-files -i --exclude-standard`.
|
|
3
|
+
# To check why a specific file is ignored, run `git check-ignore -v <filepath>`.
|
|
4
|
+
|
|
5
|
+
# === Rule for dotfiles ===
|
|
6
|
+
# Ignore all dotfiles.
|
|
7
|
+
.*
|
|
8
|
+
# Exclude specific dotfiles that we want to track.
|
|
9
|
+
!deps/**/.*
|
|
10
|
+
!.devcontainer/
|
|
11
|
+
!.devcontainer/.devcontainer.json
|
|
12
|
+
!test/fixtures/**/.*
|
|
13
|
+
!.clang-format
|
|
14
|
+
!.cpplint
|
|
15
|
+
!.editorconfig
|
|
16
|
+
!.gitattributes
|
|
17
|
+
!.github
|
|
18
|
+
!.gitignore
|
|
19
|
+
!.gitkeep
|
|
20
|
+
!.gitpod.yml
|
|
21
|
+
!.mailmap
|
|
22
|
+
!.nycrc
|
|
23
|
+
!.yamllint.yaml
|
|
24
|
+
!.configurations/
|
|
25
|
+
|
|
26
|
+
# === Rules for root dir ===
|
|
27
|
+
/core
|
|
28
|
+
/vgcore.*
|
|
29
|
+
/v8*.log
|
|
30
|
+
/perf.data
|
|
31
|
+
/perf.data.old
|
|
32
|
+
/tags
|
|
33
|
+
/tags.*
|
|
34
|
+
/doc/api.xml
|
|
35
|
+
/node
|
|
36
|
+
/node_g
|
|
37
|
+
/gon-config.json
|
|
38
|
+
/*.exe
|
|
39
|
+
/*.swp
|
|
40
|
+
/out
|
|
41
|
+
/*.msi
|
|
42
|
+
/*.wixpdb
|
|
43
|
+
/*.qlog
|
|
44
|
+
# For GitHub Codespaces
|
|
45
|
+
/pythonenv*
|
|
46
|
+
|
|
47
|
+
# === Rules for artifacts of `./configure` ===
|
|
48
|
+
/icu_config.gypi
|
|
49
|
+
/config.gypi
|
|
50
|
+
/config.status
|
|
51
|
+
/config_fips.gypi
|
|
52
|
+
|
|
53
|
+
# === Rules for MSVS artifacts ===
|
|
54
|
+
Debug/
|
|
55
|
+
Release/
|
|
56
|
+
*.sln
|
|
57
|
+
*.suo
|
|
58
|
+
*.vcxproj*
|
|
59
|
+
UpgradeLog*.XML
|
|
60
|
+
_UpgradeReport_Files/
|
|
61
|
+
*.sdf
|
|
62
|
+
*.opensdf
|
|
63
|
+
*.VC.*
|
|
64
|
+
*.wixobj
|
|
65
|
+
/tools/msvs/genfiles/
|
|
66
|
+
/npm.wxs
|
|
67
|
+
/corepack.wxs
|
|
68
|
+
/tools/msvs/msi/**/Release/
|
|
69
|
+
/tools/msvs/msi/**/obj/
|
|
70
|
+
/tools/msvs/msi/**/x64/
|
|
71
|
+
# Exclude MSVS files used for .msi file generation
|
|
72
|
+
!tools/msvs/msi/**/custom_actions.vcxproj
|
|
73
|
+
!tools/msvs/msi/**/nodemsi.sln
|
|
74
|
+
|
|
75
|
+
# === Rules for GYP artifacts ===
|
|
76
|
+
*-nodegyp*
|
|
77
|
+
/gyp-*-tool
|
|
78
|
+
/test/addons/??_*/
|
|
79
|
+
/*.mk
|
|
80
|
+
|
|
81
|
+
# === Rules for other build artifacts ===
|
|
82
|
+
/email.md
|
|
83
|
+
/deps/v8-*
|
|
84
|
+
/deps/icu
|
|
85
|
+
/deps/icu*.zip
|
|
86
|
+
/deps/icu*.tgz
|
|
87
|
+
/deps/icu-tmp
|
|
88
|
+
./node_modules
|
|
89
|
+
/android-toolchain/
|
|
90
|
+
# generated by gyp on Windows
|
|
91
|
+
/deps/openssl/openssl.props
|
|
92
|
+
/deps/openssl/openssl.targets
|
|
93
|
+
/deps/openssl/openssl.xml
|
|
94
|
+
/deps/openssl/openssl-fipsmodule.props
|
|
95
|
+
/deps/openssl/openssl-fipsmodule.targets
|
|
96
|
+
/deps/openssl/openssl-fipsmodule.xml
|
|
97
|
+
# generated by gyp on android
|
|
98
|
+
/*.target.mk
|
|
99
|
+
/*.host.mk
|
|
100
|
+
/deps/openssl/openssl.target.mk
|
|
101
|
+
/deps/zlib/zlib.target.mk
|
|
102
|
+
# generated by MSVC with /P enabled
|
|
103
|
+
tools/*/*.i
|
|
104
|
+
tools/*/*.i.tmp
|
|
105
|
+
|
|
106
|
+
# === Rules for release artifacts ===
|
|
107
|
+
/*.tar.*
|
|
108
|
+
/*.pkg
|
|
109
|
+
/SHASUMS*.txt*
|
|
110
|
+
|
|
111
|
+
# === Rules for `node_modules` ===
|
|
112
|
+
!**/node_modules/**
|
|
113
|
+
/node_modules
|
|
114
|
+
/tools/doc/node_modules
|
|
115
|
+
/tools/clang-format/node_modules
|
|
116
|
+
/tools/eslint/node_modules
|
|
117
|
+
/tools/lint-md/node_modules
|
|
118
|
+
|
|
119
|
+
# === Rules for test artifacts ===
|
|
120
|
+
/*.tap
|
|
121
|
+
/*.xml
|
|
122
|
+
/v8*-tap.json
|
|
123
|
+
/node_trace.*.log
|
|
124
|
+
# coverage related
|
|
125
|
+
/gcovr
|
|
126
|
+
/build
|
|
127
|
+
/coverage
|
|
128
|
+
|
|
129
|
+
# === Rules for Xcode artifacts ===
|
|
130
|
+
*.xcodeproj
|
|
131
|
+
*.xcworkspace
|
|
132
|
+
*.pbxproj
|
|
133
|
+
|
|
134
|
+
# === Rules for files in `/deps` ===
|
|
135
|
+
# Exclude all files in the vendored `npm`.
|
|
136
|
+
!/deps/npm/node_modules
|
|
137
|
+
# These are not needed and causes issues for distro packagers.
|
|
138
|
+
/deps/npm/node_modules/.bin/
|
|
139
|
+
# Respect V8's .gitignore
|
|
140
|
+
!deps/v8/**
|
|
141
|
+
# Ignore the libuv book
|
|
142
|
+
/deps/uv/docs/code/
|
|
143
|
+
/deps/uv/docs/src/guide/
|
|
144
|
+
# Ignore .github directories
|
|
145
|
+
/deps/**/.github/
|
|
146
|
+
# Ignore dependencies fetched by tools/v8/fetch_deps.py
|
|
147
|
+
/deps/.cipd
|
|
148
|
+
|
|
149
|
+
# === Rules for Windows vcbuild.bat ===
|
|
150
|
+
/temp-vcbuild
|
|
151
|
+
|
|
152
|
+
# === Rules for CMake ===
|
|
153
|
+
cmake-build-debug/
|
|
154
|
+
CMakeCache.txt
|
|
155
|
+
CMakeFiles
|
|
156
|
+
CTestTestfile.cmake
|
|
157
|
+
cmake_install.cmake
|
|
158
|
+
install_manifest.txt
|
|
159
|
+
*.cbp
|
|
160
|
+
|
|
161
|
+
# === Global Rules ===
|
|
162
|
+
# Keep last to avoid being excluded
|
|
163
|
+
*.pyc
|
|
164
|
+
__pycache__
|
|
165
|
+
.DS_Store
|
|
166
|
+
*~
|
|
167
|
+
|
|
168
|
+
# === Rules for C++ development ===
|
|
169
|
+
compile_commands.json
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: thumbnail-maker
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: 썸네일 생성 도구 - Pillow와 PySide6 기반
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Requires-Dist: fonttools>=4.47.0
|
|
7
|
+
Requires-Dist: pillow>=10.0.0
|
|
8
|
+
Requires-Dist: pyside6>=6.10.0
|
|
9
|
+
Requires-Dist: requests>=2.31.0
|
|
10
|
+
Requires-Dist: uv-easy>=0.2.5
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# 썸네일 생성기 (Python)
|
|
14
|
+
|
|
15
|
+
JavaScript 기반 썸네일 생성기를 Python으로 변환한 프로젝트입니다.
|
|
16
|
+
|
|
17
|
+
## 주요 변경사항
|
|
18
|
+
|
|
19
|
+
- **Pillow**: 이미지 생성 라이브러리로 사용
|
|
20
|
+
- **PySide6**: GUI 프레임워크로 사용
|
|
21
|
+
- **Python**: 모든 코드를 Python으로 변환
|
|
22
|
+
|
|
23
|
+
## 설치 방법
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install -r requirements.txt
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 사용 방법
|
|
30
|
+
|
|
31
|
+
uv를 사용하여 설치:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uv sync
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
또는 직접 실행:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
uv run python -m thumbnail_maker
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 1. GUI 사용 (추천)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
uv run thumbnail-gui
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
PySide6 기반 GUI에서 썸네일을 생성할 수 있습니다.
|
|
50
|
+
|
|
51
|
+
### 2. CLI 사용
|
|
52
|
+
|
|
53
|
+
#### 기본 사용
|
|
54
|
+
```bash
|
|
55
|
+
uv run generate-thumbnail
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### DSL 파일 지정
|
|
59
|
+
```bash
|
|
60
|
+
uv run generate-thumbnail mydsl.json -o output.png
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### 간편 CLI (genthumb)
|
|
64
|
+
```bash
|
|
65
|
+
# 기본
|
|
66
|
+
uv run genthumb
|
|
67
|
+
|
|
68
|
+
# 제목/부제목 덮어쓰기
|
|
69
|
+
uv run genthumb --title "새 제목" --subtitle "새 부제목"
|
|
70
|
+
|
|
71
|
+
# 배경 이미지 설정
|
|
72
|
+
uv run genthumb --bgImg bg.png
|
|
73
|
+
|
|
74
|
+
# 출력 파일 지정
|
|
75
|
+
uv run genthumb -o result.png
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 파일 구조
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
thumbnail_maker/
|
|
82
|
+
├── requirements.txt # Python 패키지 의존성
|
|
83
|
+
├── thumbnailRenderer.py # 핵심 렌더링 로직
|
|
84
|
+
├── generateThumbnail.py # 메인 생성 스크립트
|
|
85
|
+
├── genthumb.py # 간편 CLI 스크립트
|
|
86
|
+
├── main_gui.py # PySide6 GUI 애플리케이션
|
|
87
|
+
└── thumbnail.json # DSL 예제 파일
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## DSL 파일 형식
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"Thumbnail": {
|
|
95
|
+
"Resolution": {
|
|
96
|
+
"type": "preset",
|
|
97
|
+
"value": "16:9"
|
|
98
|
+
},
|
|
99
|
+
"Background": {
|
|
100
|
+
"type": "solid",
|
|
101
|
+
"color": "#a3e635"
|
|
102
|
+
},
|
|
103
|
+
"Texts": [
|
|
104
|
+
{
|
|
105
|
+
"type": "title",
|
|
106
|
+
"content": "제목 텍스트",
|
|
107
|
+
"gridPosition": "tl",
|
|
108
|
+
"font": {
|
|
109
|
+
"name": "SBAggroB",
|
|
110
|
+
"faces": [...]
|
|
111
|
+
},
|
|
112
|
+
"fontSize": 48,
|
|
113
|
+
"color": "#4ade80",
|
|
114
|
+
"outline": {
|
|
115
|
+
"thickness": 7,
|
|
116
|
+
"color": "#000000"
|
|
117
|
+
},
|
|
118
|
+
"enabled": true
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 해상도 설정
|
|
126
|
+
|
|
127
|
+
### Preset 모드
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"type": "preset",
|
|
131
|
+
"value": "16:9" // "16:9", "9:16", "4:3", "1:1"
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Fixed Ratio 모드
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"type": "fixedRatio",
|
|
139
|
+
"ratioValue": "16:9",
|
|
140
|
+
"width": 480 // 또는 height 지정
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Custom 모드
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"type": "custom",
|
|
148
|
+
"width": 480,
|
|
149
|
+
"height": 270
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## 기타
|
|
154
|
+
|
|
155
|
+
- JavaScript 버전의 파일들은 유지됩니다.
|
|
156
|
+
- 기존 DSL 파일과 호환됩니다.
|
|
157
|
+
- 폰트는 `fonts/` 디렉토리에 저장됩니다.
|
|
158
|
+
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# 썸네일 생성기 (Python)
|
|
2
|
+
|
|
3
|
+
JavaScript 기반 썸네일 생성기를 Python으로 변환한 프로젝트입니다.
|
|
4
|
+
|
|
5
|
+
## 주요 변경사항
|
|
6
|
+
|
|
7
|
+
- **Pillow**: 이미지 생성 라이브러리로 사용
|
|
8
|
+
- **PySide6**: GUI 프레임워크로 사용
|
|
9
|
+
- **Python**: 모든 코드를 Python으로 변환
|
|
10
|
+
|
|
11
|
+
## 설치 방법
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install -r requirements.txt
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 사용 방법
|
|
18
|
+
|
|
19
|
+
uv를 사용하여 설치:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
uv sync
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
또는 직접 실행:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
uv run python -m thumbnail_maker
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 1. GUI 사용 (추천)
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uv run thumbnail-gui
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
PySide6 기반 GUI에서 썸네일을 생성할 수 있습니다.
|
|
38
|
+
|
|
39
|
+
### 2. CLI 사용
|
|
40
|
+
|
|
41
|
+
#### 기본 사용
|
|
42
|
+
```bash
|
|
43
|
+
uv run generate-thumbnail
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### DSL 파일 지정
|
|
47
|
+
```bash
|
|
48
|
+
uv run generate-thumbnail mydsl.json -o output.png
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### 간편 CLI (genthumb)
|
|
52
|
+
```bash
|
|
53
|
+
# 기본
|
|
54
|
+
uv run genthumb
|
|
55
|
+
|
|
56
|
+
# 제목/부제목 덮어쓰기
|
|
57
|
+
uv run genthumb --title "새 제목" --subtitle "새 부제목"
|
|
58
|
+
|
|
59
|
+
# 배경 이미지 설정
|
|
60
|
+
uv run genthumb --bgImg bg.png
|
|
61
|
+
|
|
62
|
+
# 출력 파일 지정
|
|
63
|
+
uv run genthumb -o result.png
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 파일 구조
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
thumbnail_maker/
|
|
70
|
+
├── requirements.txt # Python 패키지 의존성
|
|
71
|
+
├── thumbnailRenderer.py # 핵심 렌더링 로직
|
|
72
|
+
├── generateThumbnail.py # 메인 생성 스크립트
|
|
73
|
+
├── genthumb.py # 간편 CLI 스크립트
|
|
74
|
+
├── main_gui.py # PySide6 GUI 애플리케이션
|
|
75
|
+
└── thumbnail.json # DSL 예제 파일
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## DSL 파일 형식
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"Thumbnail": {
|
|
83
|
+
"Resolution": {
|
|
84
|
+
"type": "preset",
|
|
85
|
+
"value": "16:9"
|
|
86
|
+
},
|
|
87
|
+
"Background": {
|
|
88
|
+
"type": "solid",
|
|
89
|
+
"color": "#a3e635"
|
|
90
|
+
},
|
|
91
|
+
"Texts": [
|
|
92
|
+
{
|
|
93
|
+
"type": "title",
|
|
94
|
+
"content": "제목 텍스트",
|
|
95
|
+
"gridPosition": "tl",
|
|
96
|
+
"font": {
|
|
97
|
+
"name": "SBAggroB",
|
|
98
|
+
"faces": [...]
|
|
99
|
+
},
|
|
100
|
+
"fontSize": 48,
|
|
101
|
+
"color": "#4ade80",
|
|
102
|
+
"outline": {
|
|
103
|
+
"thickness": 7,
|
|
104
|
+
"color": "#000000"
|
|
105
|
+
},
|
|
106
|
+
"enabled": true
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## 해상도 설정
|
|
114
|
+
|
|
115
|
+
### Preset 모드
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"type": "preset",
|
|
119
|
+
"value": "16:9" // "16:9", "9:16", "4:3", "1:1"
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Fixed Ratio 모드
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"type": "fixedRatio",
|
|
127
|
+
"ratioValue": "16:9",
|
|
128
|
+
"width": 480 // 또는 height 지정
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Custom 모드
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"type": "custom",
|
|
136
|
+
"width": 480,
|
|
137
|
+
"height": 270
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## 기타
|
|
142
|
+
|
|
143
|
+
- JavaScript 버전의 파일들은 유지됩니다.
|
|
144
|
+
- 기존 DSL 파일과 호환됩니다.
|
|
145
|
+
- 폰트는 `fonts/` 디렉토리에 저장됩니다.
|
|
146
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
메인 썸네일 생성 스크립트
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
import os
|
|
9
|
+
import json
|
|
10
|
+
import argparse
|
|
11
|
+
from thumbnailRenderer import ThumbnailRenderer
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def main():
|
|
15
|
+
parser = argparse.ArgumentParser(description='썸네일 생성')
|
|
16
|
+
parser.add_argument('dsl', nargs='?', default='thumbnail.json', help='DSL 파일 경로')
|
|
17
|
+
parser.add_argument('-o', '--output', default='thumbnail.png', help='출력 파일 경로')
|
|
18
|
+
|
|
19
|
+
args = parser.parse_args()
|
|
20
|
+
|
|
21
|
+
# DSL 파일 확인
|
|
22
|
+
if not os.path.exists(args.dsl):
|
|
23
|
+
print(f"오류: DSL 파일을 찾을 수 없습니다: {args.dsl}")
|
|
24
|
+
sys.exit(1)
|
|
25
|
+
|
|
26
|
+
# DSL 읽기
|
|
27
|
+
with open(args.dsl, 'r', encoding='utf-8') as f:
|
|
28
|
+
dsl = json.load(f)
|
|
29
|
+
|
|
30
|
+
# 썸네일 생성
|
|
31
|
+
ThumbnailRenderer.render_thumbnail(dsl, args.output)
|
|
32
|
+
|
|
33
|
+
print(f"✅ 썸네일 생성 완료: {args.output}")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
if __name__ == '__main__':
|
|
37
|
+
main()
|
|
38
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
간단한 CLI 썸네일 생성 스크립트
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
import os
|
|
9
|
+
import json
|
|
10
|
+
import argparse
|
|
11
|
+
import base64
|
|
12
|
+
from thumbnailRenderer import ThumbnailRenderer
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main():
|
|
16
|
+
parser = argparse.ArgumentParser(description='썸네일 생성 (간편 CLI)')
|
|
17
|
+
parser.add_argument('dsl', nargs='?', default='thumbnail.json', help='DSL 파일 경로')
|
|
18
|
+
parser.add_argument('-o', '--output', default='thumbnail.png', help='출력 파일 경로')
|
|
19
|
+
parser.add_argument('--title', help='제목 덮어쓰기')
|
|
20
|
+
parser.add_argument('--subtitle', help='부제목 덮어쓰기')
|
|
21
|
+
parser.add_argument('--bgImg', help='배경 이미지 경로')
|
|
22
|
+
|
|
23
|
+
args = parser.parse_args()
|
|
24
|
+
|
|
25
|
+
# DSL 파일 확인
|
|
26
|
+
if not os.path.exists(args.dsl):
|
|
27
|
+
print(f"오류: DSL 파일을 찾을 수 없습니다: {args.dsl}")
|
|
28
|
+
sys.exit(1)
|
|
29
|
+
|
|
30
|
+
# DSL 읽기
|
|
31
|
+
with open(args.dsl, 'r', encoding='utf-8') as f:
|
|
32
|
+
dsl = json.load(f)
|
|
33
|
+
|
|
34
|
+
# 배경 이미지 처리
|
|
35
|
+
if args.bgImg and os.path.exists(args.bgImg):
|
|
36
|
+
with open(args.bgImg, 'rb') as f:
|
|
37
|
+
image_data = f.read()
|
|
38
|
+
base64_str = base64.b64encode(image_data).decode('utf-8')
|
|
39
|
+
data_url = f"data:image/png;base64,{base64_str}"
|
|
40
|
+
|
|
41
|
+
dsl['Thumbnail']['Background']['type'] = 'image'
|
|
42
|
+
dsl['Thumbnail']['Background']['imagePath'] = data_url
|
|
43
|
+
|
|
44
|
+
# 제목/부제목 덮어쓰기
|
|
45
|
+
if 'Texts' in dsl.get('Thumbnail', {}):
|
|
46
|
+
for txt in dsl['Thumbnail']['Texts']:
|
|
47
|
+
if args.title and txt.get('type') == 'title':
|
|
48
|
+
txt['content'] = args.title
|
|
49
|
+
if args.subtitle and txt.get('type') == 'subtitle':
|
|
50
|
+
txt['content'] = args.subtitle
|
|
51
|
+
|
|
52
|
+
# 썸네일 생성
|
|
53
|
+
ThumbnailRenderer.render_thumbnail(dsl, args.output)
|
|
54
|
+
|
|
55
|
+
print(f"✅ 썸네일 생성 완료: {args.output}")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
if __name__ == '__main__':
|
|
59
|
+
main()
|
|
60
|
+
|