文档(ClaudeCode): arno-article-summary 缩略图生成增加 Pillow fallback
金鹏.md 补上今日文章的缩略图引用。
This commit is contained in:
@@ -163,6 +163,20 @@ convert "<大图路径>" -resize 160x90^ -gravity center -extent 160x90 "<同目
|
||||
ffmpeg -i "<大图路径>" -vf "scale=160:90:force_original_aspect_ratio=increase,crop=160:90" "<缩略图路径>" -y
|
||||
```
|
||||
|
||||
若两者均不可用,回退到 Python Pillow:
|
||||
|
||||
```python
|
||||
from PIL import Image
|
||||
img = Image.open("<大图路径>")
|
||||
w, h = img.size
|
||||
target = 160/90
|
||||
if w/h > target:
|
||||
nw = int(h * target); img = img.crop(((w-nw)//2, 0, (w+nw)//2, h))
|
||||
else:
|
||||
nh = int(w / target); img = img.crop((0, (h-nh)//2, w, (h+nh)//2))
|
||||
img.resize((160, 90), Image.LANCZOS).save("<缩略图路径>")
|
||||
```
|
||||
|
||||
### 8. 输出格式
|
||||
|
||||
#### 8a. 体系内文章组(有关联的文章,用父条目分组)
|
||||
|
||||
Reference in New Issue
Block a user