烫金字体生成SVG、图片 API ,已开源 !

234 阅读2分钟

新年快到了做点喜庆的小玩意, 喜欢的可以点点 star 🙂

gold-foil-font-api.png

gold-foil-font-api description chinese.png

gold-foil-font-api description english.png

作者: Sinvon

GitHub: github.com/isinvon

Github 项目地址: github.com/isinvon/gol…

转载请声明出处 !

🚀 测试环境 ➽

  • Java v21
  • Maven v3.9.8

✨ 修改字体颜色 ➽

🟡 金色 ➽

修改参数 text 为想要的字即可,无需加其他参数,例如:

http://localhost:8080/api/gold-foil-image?text=新年快乐

happy new year gold.png

⚪ 银色 ➽

修改参数 text 为想要的字,且需要将参数 fontColorType 设置为 silver,例如:

http://localhost:8080/api/gold-foil-image?text=新年快乐&fontColorType=silver

happy new year silver.png

⚫ 黑色 ➽

修改参数 text 为想要的字,且需要将参数 fontColorType 设置为 black,例如:

http://localhost:8080/api/gold-foil-image?text=新年快乐&fontColorType=black

happy new year black.png

🖤 黑色渐变 ➽

修改参数 text 为想要的字,且需要将参数 fontColorType 设置为 blackGradient,例如:

http://localhost:8080/api/gold-foil-image?text=新年快乐&fontColorType=blackGradient

happy new year blackGradient.png

✏️ 修改字体内容 ➽

修改参数 text 为想要的字即可,无需加其他参数,例如:

http://localhost:8080/api/gold-foil-image?text=66大顺

66大顺.png

🏮 春联背景 ➽

添加参数 isBackgroundtrue,例如:

http://localhost:8080/api/gold-foil-image?text=鸡你太美&isBackground=true

每一次请求都是随机的,所以每次请求的背景颜色都是不一样的,例如:

ikun-1.png

ikun-4.png

ikun-2.png

ikun-3.png

☀️ 渐变方向 ➽

leftToRight - 从左到右

添加参数 gradientPosleftToRight,例如:

http://localhost:8080/api/gold-foil-image?text=鸡你太美&gradientPos=leftToRight

topToBottom - 从上到下

添加参数 gradientPostopToBottom,例如:

http://localhost:8080/api/gold-foil-image?text=光泽效果&gradientPos=topToBottom

leftTopToRightBottom - 从左上到右下

添加参数 gradientPosleftTopToRightBottom,例如:

http://localhost:8080/api/gold-foil-image?text=从左上到右下&gradientPos=leftTopToRightBottom

leftBottomToRightTop - 从左下到右上

添加参数 gradientPosleftBottomToRightTop,例如:

http://localhost:8080/api/gold-foil-image?text=从左下到右上&gradientPos=leftBottomToRightTop

rightToLeft - 从右到左

添加参数 gradientPosrightToLeft,例如:

http://localhost:8080/api/gold-foil-image?text=从右到左&gradientPos=rightToLeft

bottomToTop - 从下到上

添加参数 gradientPosbottomToTop,例如:

http://localhost:8080/api/gold-foil-image?text=从下到上&gradientPos=bottomToTop

rightTopToLeftBottom - 从右上到左下

添加参数 gradientPosrightTopToLeftBottom,例如:

http://localhost:8080/api/gold-foil-image?text=从右上到左下&gradientPos=rightTopToLeftBottom

rightBottomToLeftTop - 从右下到左上

添加参数 gradientPosrightBottomToLeftTop,例如:

http://localhost:8080/api/gold-foil-image?text=从右下到左上&gradientPos=rightBottomToLeftTop

circular - 圆形

添加参数 gradientPoscircular,例如:

http://localhost:8080/api/gold-foil-image?text=圆形渐变&gradientPos=circular

circularRandom - 圆形随机

添加参数 gradientPoscircularRandom,例如:

http://localhost:8080/api/gold-foil-image?text=圆形随机&gradientPos=circularRandom

random - 随机 (如果不加 gradientPos 参数,默认就是这个随机的)

添加参数 gradientPosrandom,例如:

http://localhost:8080/api/gold-foil-image?text=随机渐变&gradientPos=random

🌟 SVG 生成

请使用以下接口

http://localhost:8080/api/gold-foil-svg?text=你好

请求之后出现如下页面, 直接复制即可

svg.png

作者: Sinvon

GitHub: github.com/isinvon

Github 项目地址: github.com/isinvon/gol…

转载请声明出处 !