轻松搭建生成简易头像的api服务
docker-compose.yml
version: '3'
services:
hello_avatar:
image: dreamplay/hello_avatar
ports:
- 13130:13130
运行
docker-compose up -d
访问示例页面
访问接口:
接口将返回png图片内容,尺寸为500*500
参数控制:
字段 | 是否必填 | 类型 | 简介 |
---|---|---|---|
type | 否 | string | 生成头像类型, ugly-avatar-丑头像(默认),参考:https://github.com/txstc55/ugly-avatar multiavatar-插画头像,参考:https://multiavatar.com/ jdenticon-随机头像,参考:https://jdenticon.com/icon-designer.html dicebear-风格头像,参考:https://www.dicebear.com/styles/ |
style | 否 | string | 风格类型,仅当type=dicebear时有效 male-男性风格 female-女性风格 avataaars-由Avataaars设计的头像 bottts-像素机器人 gridy-棋盘格式风格 human-贴近真实人类样貌 identicon-GitHub使用的Identicons风格的头像 initials-显示用户初始字母的简单风格 |
seed | 否 | string | 头像生成种子变量,仅当type=dicebear且style=initials时有效 |
type=ugly-avatar
type=multiavatar
type=jdenticon
type=dicebear
风格类型+种子变量 | male | female | avataaars | bottts | gridy | human | identicon | initials+测试 |
---|---|---|---|---|---|---|---|---|
示例 | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |