2026 / 4 / 12
大概是突然想着需要了吧,就急忙找ai搞了一个()
``html ](https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css"> )
输入文字,自定义样式,一键生成专业封面图
生成后可右键图片保存,或直接点击下载按钮
© 2025 文字封面图生成器 | 纯前端实现,安全无数据上传
${spacing}px; // 绘制文字(自动换行) const lines = text.split('\n'); const lineHeight = size 1.5; const totalHeight = lines.length lineHeight; let startY = height / 2 - (totalHeight / 2) + lineHeight / 2; lines.forEach((line, index) => { ctx.fillText(line, width / 2, startY + (index * lineHeight)); }); } // 绘制圆角矩形 function drawRoundedRect(x, y, width, height, radius, color) { ctx.fillStyle = color; ctx.beginPath(); ctx.moveTo(x + radius, y); ctx.lineTo(x + width - radius, y); ctx.quadraticCurveTo(x + width, y, x + width, y + radius); ctx.lineTo(x + width, y + height - radius); ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height); ctx.lineTo(x + radius, y + height); ctx.quadraticCurveTo(x, y + height, x, y + height - radius); ctx.lineTo(x, y + radius); ctx.quadraticCurveTo(x, y, x + radius, y); ctx.closePath(); ctx.fill(); } // 下载封面 function downloadCover() { const link = document.createElement('a'); link.download = 封面_${new Date().getTime()}.png; link.href = coverCanvas.toDataURL('image/png'); link.click(); } `` ``