xiaoan-tools 0.1.0__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.
- xiaoan_tools-0.1.0/PKG-INFO +39 -0
- xiaoan_tools-0.1.0/README.md +18 -0
- xiaoan_tools-0.1.0/pyproject.toml +3 -0
- xiaoan_tools-0.1.0/setup.cfg +4 -0
- xiaoan_tools-0.1.0/setup.py +27 -0
- xiaoan_tools-0.1.0/xiaoan_tools/__init__.py +2 -0
- xiaoan_tools-0.1.0/xiaoan_tools/cover.py +68 -0
- xiaoan_tools-0.1.0/xiaoan_tools.egg-info/PKG-INFO +39 -0
- xiaoan_tools-0.1.0/xiaoan_tools.egg-info/SOURCES.txt +11 -0
- xiaoan_tools-0.1.0/xiaoan_tools.egg-info/dependency_links.txt +1 -0
- xiaoan_tools-0.1.0/xiaoan_tools.egg-info/entry_points.txt +2 -0
- xiaoan_tools-0.1.0/xiaoan_tools.egg-info/requires.txt +1 -0
- xiaoan_tools-0.1.0/xiaoan_tools.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xiaoan-tools
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 小安工具箱 - 小红书封面生成、办公效率工具集
|
|
5
|
+
Home-page: https://github.com/slm527/xiaoan-tools
|
|
6
|
+
Author: xiaoan
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: Pillow>=9.0
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: classifier
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: home-page
|
|
18
|
+
Dynamic: requires-dist
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
# 🛠️ 小安工具箱
|
|
23
|
+
|
|
24
|
+
> pip install xiaoan-tools
|
|
25
|
+
|
|
26
|
+
## 功能
|
|
27
|
+
|
|
28
|
+
### 小红书封面图生成
|
|
29
|
+
```bash
|
|
30
|
+
xiaohongshu-cover "一篇笔记憋3小时" "AI工具" cover.png
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
输出1080x1440精美封面,粉色系+文字阴影,可直接发小红书。
|
|
34
|
+
|
|
35
|
+
## 赞赏支持
|
|
36
|
+
|
|
37
|
+
如果这个工具对你有帮助,欢迎微信扫码支持 👇
|
|
38
|
+
|
|
39
|
+

|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# 🛠️ 小安工具箱
|
|
2
|
+
|
|
3
|
+
> pip install xiaoan-tools
|
|
4
|
+
|
|
5
|
+
## 功能
|
|
6
|
+
|
|
7
|
+
### 小红书封面图生成
|
|
8
|
+
```bash
|
|
9
|
+
xiaohongshu-cover "一篇笔记憋3小时" "AI工具" cover.png
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
输出1080x1440精美封面,粉色系+文字阴影,可直接发小红书。
|
|
13
|
+
|
|
14
|
+
## 赞赏支持
|
|
15
|
+
|
|
16
|
+
如果这个工具对你有帮助,欢迎微信扫码支持 👇
|
|
17
|
+
|
|
18
|
+

|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r", encoding="utf-8") as f:
|
|
4
|
+
long_description = f.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name="xiaoan-tools",
|
|
8
|
+
version="0.1.0",
|
|
9
|
+
author="xiaoan",
|
|
10
|
+
description="小安工具箱 - 小红书封面生成、办公效率工具集",
|
|
11
|
+
long_description=long_description,
|
|
12
|
+
long_description_content_type="text/markdown",
|
|
13
|
+
url="https://github.com/slm527/xiaoan-tools",
|
|
14
|
+
packages=find_packages(),
|
|
15
|
+
classifiers=[
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
],
|
|
20
|
+
python_requires=">=3.8",
|
|
21
|
+
install_requires=["Pillow>=9.0"],
|
|
22
|
+
entry_points={
|
|
23
|
+
"console_scripts": [
|
|
24
|
+
"xiaohongshu-cover=xiaoan_tools.cover:main",
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""小红书封面图生成器"""
|
|
2
|
+
import sys
|
|
3
|
+
import os
|
|
4
|
+
from PIL import Image, ImageDraw, ImageFont
|
|
5
|
+
|
|
6
|
+
WIDTH, HEIGHT = 1080, 1440
|
|
7
|
+
|
|
8
|
+
def create_cover(title, subtitle="", output="cover.png"):
|
|
9
|
+
img = Image.new("RGB", (WIDTH, HEIGHT), "#FFF5F5")
|
|
10
|
+
draw = ImageDraw.Draw(img)
|
|
11
|
+
|
|
12
|
+
font_paths = [
|
|
13
|
+
"/System/Library/Fonts/PingFang.ttc",
|
|
14
|
+
"/System/Library/Fonts/STHeiti Light.ttc",
|
|
15
|
+
"/System/Library/Fonts/Supplemental/Songti.ttc",
|
|
16
|
+
]
|
|
17
|
+
font_path = None
|
|
18
|
+
for p in font_paths:
|
|
19
|
+
if os.path.exists(p):
|
|
20
|
+
font_path = p
|
|
21
|
+
break
|
|
22
|
+
|
|
23
|
+
title_font = ImageFont.truetype(font_path, 72) if font_path else ImageFont.load_default()
|
|
24
|
+
subtitle_font = ImageFont.truetype(font_path, 40) if font_path else ImageFont.load_default()
|
|
25
|
+
|
|
26
|
+
lines = title.split("\n")
|
|
27
|
+
y_start = HEIGHT // 3
|
|
28
|
+
|
|
29
|
+
for i, line in enumerate(lines):
|
|
30
|
+
shadow_color = "#FFD0D0"
|
|
31
|
+
for dx, dy in [(3, 3), (2, 2), (1, 1)]:
|
|
32
|
+
bbox = draw.textbbox((0, 0), line, font=title_font)
|
|
33
|
+
tw = bbox[2] - bbox[0]
|
|
34
|
+
x = (WIDTH - tw) // 2 + dx
|
|
35
|
+
y = y_start + i * 100 + dy
|
|
36
|
+
draw.text((x, y), line, fill=shadow_color, font=title_font)
|
|
37
|
+
|
|
38
|
+
bbox = draw.textbbox((0, 0), line, font=title_font)
|
|
39
|
+
tw = bbox[2] - bbox[0]
|
|
40
|
+
x = (WIDTH - tw) // 2
|
|
41
|
+
y = y_start + i * 100
|
|
42
|
+
draw.text((x, y), line, fill="#D4380D", font=title_font)
|
|
43
|
+
|
|
44
|
+
if subtitle:
|
|
45
|
+
sy = y_start + len(lines) * 100 + 60
|
|
46
|
+
bbox = draw.textbbox((0, 0), subtitle, font=subtitle_font)
|
|
47
|
+
sw = bbox[2] - bbox[0]
|
|
48
|
+
draw.text(((WIDTH - sw) // 2, sy), subtitle, fill="#888888", font=subtitle_font)
|
|
49
|
+
|
|
50
|
+
draw.rectangle([200, HEIGHT - 200, WIDTH - 200, HEIGHT - 195], fill="#FFD0D0")
|
|
51
|
+
img.save(output, "PNG")
|
|
52
|
+
print(f"✅ 封面图已生成: {output}")
|
|
53
|
+
size = os.path.getsize(output) / 1024
|
|
54
|
+
print(f" 尺寸: {WIDTH}x{HEIGHT} | 大小: {size:.0f}KB")
|
|
55
|
+
|
|
56
|
+
def main():
|
|
57
|
+
if len(sys.argv) < 2:
|
|
58
|
+
print("用法: xiaohongshu-cover <标题> [副标题] [输出文件名]")
|
|
59
|
+
print("示例: xiaohongshu-cover '一篇笔记憋3小时' 'AI工具' mycover.png")
|
|
60
|
+
sys.exit(1)
|
|
61
|
+
|
|
62
|
+
title = sys.argv[1].replace("\\n", "\n")
|
|
63
|
+
subtitle = sys.argv[2] if len(sys.argv) > 2 else ""
|
|
64
|
+
output = sys.argv[3] if len(sys.argv) > 3 else "cover.png"
|
|
65
|
+
create_cover(title, subtitle, output)
|
|
66
|
+
|
|
67
|
+
if __name__ == "__main__":
|
|
68
|
+
main()
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xiaoan-tools
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 小安工具箱 - 小红书封面生成、办公效率工具集
|
|
5
|
+
Home-page: https://github.com/slm527/xiaoan-tools
|
|
6
|
+
Author: xiaoan
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: Pillow>=9.0
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: classifier
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: home-page
|
|
18
|
+
Dynamic: requires-dist
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
# 🛠️ 小安工具箱
|
|
23
|
+
|
|
24
|
+
> pip install xiaoan-tools
|
|
25
|
+
|
|
26
|
+
## 功能
|
|
27
|
+
|
|
28
|
+
### 小红书封面图生成
|
|
29
|
+
```bash
|
|
30
|
+
xiaohongshu-cover "一篇笔记憋3小时" "AI工具" cover.png
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
输出1080x1440精美封面,粉色系+文字阴影,可直接发小红书。
|
|
34
|
+
|
|
35
|
+
## 赞赏支持
|
|
36
|
+
|
|
37
|
+
如果这个工具对你有帮助,欢迎微信扫码支持 👇
|
|
38
|
+
|
|
39
|
+

|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
setup.py
|
|
4
|
+
xiaoan_tools/__init__.py
|
|
5
|
+
xiaoan_tools/cover.py
|
|
6
|
+
xiaoan_tools.egg-info/PKG-INFO
|
|
7
|
+
xiaoan_tools.egg-info/SOURCES.txt
|
|
8
|
+
xiaoan_tools.egg-info/dependency_links.txt
|
|
9
|
+
xiaoan_tools.egg-info/entry_points.txt
|
|
10
|
+
xiaoan_tools.egg-info/requires.txt
|
|
11
|
+
xiaoan_tools.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Pillow>=9.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
xiaoan_tools
|