- 素材 a.png
- html card.html
<!DOCTYPE html>
<html lang="zh-CN"><head><meta charset="UTF-8"><title>固定樣式卡片</title><style>/* 基礎樣式和頁面居中 */body {font-family: "微軟雅黑", "PingFang SC", "Helvetica Neue", sans-serif;background-color: #f5f5f5;margin: 0;display: flex;justify-content: center;align-items: center;min-height: 100vh;}/* 卡片容器 - 固定尺寸 */.card {width: 1200px;height: 675px;display: flex;background-color: #fff;border-radius: 16px;box-shadow: 0 8px M20px rgba(0, 0, 0, 0.1);overflow: hidden;}/* 卡片圖片 - 固定尺寸 */.card img {width: 600px;height: 675px;object-fit: cover;border-radius: 16px;}/* 卡片內容區域 - 固定尺寸 */.card-content {width: 600px;height: 675px;padding: 40px;display: flex;flex-direction: column;justify-content: center;text-align: left;font-size: 18px;box-sizing: border-box;}.card-content ol {padding-left: 25px;margin: 0;}.card-content li {margin-bottom: 20px;line-height: 1.7;}/* 移除最后一個列表項的下邊距,使布局更整潔 */.card-content li:last-child {margin-bottom: 0;}.card-content strong {color: #333;}</style>
</head><body><div class="card"><img src="a.png" alt="示例圖片"><div class="card-content"><ol><li><strong>多場景融合構圖</strong>:將騎行、綠植、建筑元素巧妙結合,通過低角度與仰視視角強化空間層次,實現“人-景-境”三位一體的敘事感。</li><li><strong>動態姿態自然捕捉</strong>:坐車輕扶、半蹲觸葉、倚欄側身等姿勢貼近生活場景,配合微微前傾與肢體放松,真實傳遞隨性松弛的氛圍。</li><li><strong>前景框架增強沉浸感</strong>:利用自行車輪、綠植枝葉作為前景虛化框,結合三分法構圖,提升畫面縱深與視覺引導力。</li><li><strong>光線與參數精準匹配</strong>:根據拍攝角度靈活調整光圈與快門(f/2.8–f/4,1/200s–1/320s),兼顧虛化效果與動作清晰度,實現專業級光影控制。</li><li><strong>情緒與環境高度協同</strong>:表情與肢體語言緊扣場景主題(如騎行的自由、綠植的溫柔、建筑的沉思),實現“環境即情緒”的視覺表達。</li></ol></div></div></body></html>
- python
pip install plutoprint
import plutoprint
from plutoprint import PageSize
from IPython.display import Image as display_imagesize = PageSize(16 * 64, 9 * 64)
book = plutoprint.Book(size=size, media=plutoprint.MEDIA_TYPE_SCREEN)with open("card.html", "r") as f:html_text = f.read()
book.load_html(html_text,user_style="body { text-align: center; font-family: 'Noto Serif SC';}",
)
book.write_to_png("card.png", int(book.get_document_width() * 2), int(book.get_document_height() * 2)
)display_image("card.png")
-
結果
-
官方倉庫
【https://github.com/plutoprint/plutoprint】
另一個方案js的,也非常的不錯【https://github.com/zumerlab/snapdom】